-
Search Results
-
I’m doing ADC with PIC 18F46K22, 16×2 lcd, LM3 temperature sensor, 20 MHz oscillator, MPLAB XC8 and PicKit3 programmer. I can do the generate the hex file and simulate it on Proteus and it works fine, but on hardware it doesn’t work. The LCD is switched on, but doesn’t display the analog value.
I wrote a small program to switch the led on off with delay and write something on the LCD on off with delay and this works on Proteus and hardware.
Please assist
I noticed that most times I write code with pic16f877a, it doesn’t work properly, gives me error messages on proteus say memory load too large… please I need help… what can be done to this
Topic: I2C PIC18F4550 to PIC18F4550
Hi,
I was checking your nice tutorial from here:
https://electrosome.com/i2c-pic-microcontroller-mplab-xc8/
<div class=”post-message ” dir=”auto” data-role=”message”>
<div>I decided to try it with PIC18F4550 to PIC18F4550 and I went in troubles.
I have tested your Proteus project with PIC16F877A and works fine.
Then I decided to replace PIC16F877A with PIC18F4550.
I have an error and maybe you can take a look and give some hints. The error comes from Slave code.
I made the changing from PIC16F877A to PIC18F4550 in 2 steps.
In the first step I have changed only the Master with PIC18F4550 and the Slave was still PIC16F877A.
Everything worked fine here. In my case the Master only reads from Salve and display the switches result on LEDs.
Here is the screenshots and XC8 code, the Master C code and “pro2.zip” with Proteus + MPLABX full XC8 code for Master and Slave:
https://goo.gl/uTijwg
This project works fine.In the second step I have changed also the Slave with PIC18F4550.
Here is the screenshots and XC8 code, the Master and the Slave C code and “pro3.zip” with Proteus + MPLABX full XC8 code for Master and Slave:
https://goo.gl/dnGDMQHere I have a problem and for sure comes from Slave XC8 code.
When I compile it says “variable “_z” is not used” and “portion of expression has no effect” where z is used.
Could you please help to debug the problem?</div>
</div>Greetings,
I have a few question to ask regarding my circuit in Proteus 8.6. I’ve constructed a circuit that posted in this link –> https://electrosome.com/switch-pic-microcontroller-hi-tech-c/ . I also built the program using the Hitech C compiler using Mplab software. And then, when I try to run the simulation in the Proteus using the hex file I built in Mplab, it didn’t even say error or something like that, instead, the led in the circuit itself won’t light up (no error message in Proteus while I run the simulation). I already tried to reinstall all my programming and other software (mplab, proteus, hitech c). But, it doesn’t work. What should I do? This is really stressing me out. This website is the only one where I can study more about Embedded Programming.
p/s: Pictures are included in this forum for reference.Thank you.
Hi,
I am a beginner in this field. I am using PIC 16F877A microcontroller for my project. Everything is working fine in Proteus but in real hardware I am not even able to write the program to the IC. Screenshot of the error is attached.
I am doing a project which requires that I turn on and off two LED’s independently from a computer using serial port communication. I send a character like ‘A’ via the serial port and turn on one LED for say 1 minute and send another character like ‘B’ and turn on another LED for 2 minutes. My problem is that when using Timer0 of pic 18F87k22, I can’t implement the 1 minute and 2 minute delays independently. When I turn on the one LED the other one doesn’t respond and vice versa. I am simulating using Proteus and my code is is in MikroC as shown below:
char uart_rd; char cnt; void interrupt () { if (TMR0IF_bit) { cnt++; // increment counters TMR0IF_bit = 0; // clear TMR0IF TMR0L = 0xDC; // set TMR0 for aproximetly 1 sec TMR0H = 0x0B; } } void one_min_delay () { TRISB = 0; // PORTB is output TMR0H = 0x0B; TMR0L = 0xDC; // Timer0 initial value T0CON = 0x84; // Set TMR0 to 8bit mode and prescaler to 256 GIE_bit = 1; // Enable global interrupt TMR0IE_bit = 1; // Enable Timer0 interrupt cnt = 0; // Initialize cnt do { if (cnt >= 60) { LATB = 0x00; // turnoff PORTB LEDs cnt = 0; // Reset cnt } }while(1); } void two_min_delay () { TRISB = 0; // PORTB is output TMR0H = 0x0B; TMR0L = 0xDC; // Timer0 initial value T0CON = 0x84; // Set TMR0 to 8bit mode and prescaler to 256 GIE_bit = 1; // Enable global interrupt TMR0IE_bit = 1; // Enable Timer0 interrupt cnt = 0; // Initialize cnt do { if (cnt >= 120) { LATB = 0x00; // turnoff PORTB LEDs cnt = 0; // Reset cnt } }while(1); } void main() { UART1_Init(9600); // Initialize UART module at 9600 bps Delay_ms(100); // Wait for UART module to stabilize TRISB = 0x00; while (1) { if (UART1_Data_Ready()) { // If data is received, uart_rd = UART1_Read(); } if (uart_rd=='A') { LATB = 0x01; one_min_delay(); } else if (uart_rd == 'B') { PORTB = 0x02; two_min_delay (); } uart_rd ='\0'; } }Hi guys, I am kinda new to these forums and this is my first question.
I need some help in writing the code to extract NMEA GPS coordinates, display them on a 2 by 16 LCD and send them via GSM for accident alert notification purposes. i have dealt with the GSM part (or at least i think so) but now i need to be able to send the coordinates from the location of the accident occurrence (accident alert system for vehicle project). To do that, i need to extract the coordinates from the $GPGGA line or $GPGLL line (or whichever works best). I need your help guys, I do not have much time left to finish the project. I am using PIC18F45k22 and for simulation of GPS I am using Virtual GPS that i have virtually linked with Proteus (v8.0). I would very much appreciate it if you could help me with a working code that i can integrate into the whole code.
Thanks
Hello,
I am new to PIC Microcontrollers, but have gone through all the tutorials. I can write codes on my own for PWM and ADC seperately. But when I try to use both at the same time I don’t get any output signal at CCP1 *checked with Proteus also*I am trying to use 2 buttons RC4 and RC5 to increase and decrease the PWM duty cycle. And use ADC for lighting up LEDs , but I can get any signal out of CCP1.
Here is the code I tried:
unsigned int ADC; void main() { short duty1 = 16; CMCON = 0x07; ADCON1 = 0x80; TRISA = 0xFF; //input analog signal TRISC = 0x30; //RC4 RC5 input button, RC2 output PWM TRISB = 0x00; //output MSB's of ADC TRISD = 0x00; //output LSB's of ADC //ADC Function do { ADC = ADC_Read(1); PORTB = ADC; PORTD = ADC>>2; } while(1); //////////////////////////////////////////////// //PWM Function PWM1_Init(5000); PWM1_Start(); PWM1_set_duty(duty1); while(1) { if (PORTC.F4 == 0) { Delay_ms(1); duty1++; PWM1_set_duty(duty1); } if (PORTC.F5 == 0) { delay_ms(1); duty1--; PWM1_set_duty(duty1); } delay_ms(100); } }
