The PIC18 series 8 bit microcontrollers manufactured by Microchip Technology.
Questions tagged [pic18]
230 questions
1
vote
1 answer
Function writing "wrong" value to register - PIC18F
I've written a function in which you should able to input a number and the function then calculates the value to write to the register. However it looks like it's writing the "wrong" value to the register. I've used a calculator and wolframalpha to…

Sam W
- 243
- 3
- 11
1
vote
1 answer
How to burn PIC hex from arduino?
I'm new on this field ...
I have a Arduino ESP8266 connected to a PIC18F trought UART2, I wonder if already there is something out there to send the HEX file from the ESP to the pic and burn the firmware
PS: the ESP already has the HEX file stored…

Colas
- 157
- 1
- 2
- 12
1
vote
0 answers
Firmware identification by uC bootloader before updating
Currently I am working in a system composed by an uC (PIC18) which is able to be updated over the air.
When I want to update a device, I send the firmware (.bin) by air and it is stored in an EEPROM. Then, the uC reads this EEPROM and flashes…

dcom
- 11
- 2
1
vote
1 answer
what does the PIC18 compile error 195 mean?
I'm relatively new to programming PIC18 micro-controllers and I keep getting a compile error 195 when I try to get my code to compile. The PIC I'm using is a PIC18F46k80, and the application I'm trying to program it for is for a piece of hardware…

Julian_Space_Dude
- 13
- 3
1
vote
1 answer
PIC18F67k40 UART RECEIVER Part Work Proper BUT Transmitter Part not Work?
device PIC18F67k40 UART RECEIVER Part Work Proper BUT Transmitter Part not Work ??
UART Receiver part work properly. can any one suggest me what i am doing wrong in below code.
device is on 16Mhz and baud rate is 115200
device PIC18F67k40…

Kalpesh Navadiya
- 49
- 4
1
vote
2 answers
Trouble Compiling my Microchip PIC18f4550 USB project using MPLAB X IDE C18 compiler. The compiler keep highlighting "syntax error" and won't compile
I am unable to compile my code using the MPLAB X IDE C18 Compiler. The link below is a link to my printscreen picture of the error.As you can see the IDE said that there is a syntax error at the statement LED3 = 0;
PrintScreen of Error
I have attach…

Koh Yi Min Jason
- 21
- 4
1
vote
2 answers
A macro gives a wrong value in C language
I am trying to write a subroutine that generates a delay of 1000 ms using the Timer1 of the PIC18F4321 in 16-bit mode in MPLAB X IDE with XC8 compiler. This delay is exploited to toggle a LED. My problem is that I can't get the delay wanted (1000…

Samir Fassak
- 49
- 5
1
vote
1 answer
getcUSART not working as intended? (PIC18F with bluetooth)
I am working on a project with C18 compiler and PIC18F4520.
I am having trouble using getcUSART. When I send characters over bluetooth module, at one point it would just hang.
int input(char Arr[])
{
Delay10KTCYx(400); // Delay between data…

Briget
- 31
- 3
1
vote
1 answer
Frequency of PWM changes when I generate PWM on CCP1 and CCP2 simultaneously in PIC18F46K22
When I generate PWM on CCP1 only, I am able to get SPWM of 50HZ with 10kHz switching frequency. When I enable the PWM on CCP2 for another SPWM, the frequency of both SPWMs changes. But if I generate it on either 1 of the outputs, it works fine. I am…

Ken Adams
- 11
- 1
1
vote
1 answer
USART crashes on PIC18F2550, What can I do?
I'm working in the communication of a PIC18F4550 and the PC with a pair of xBEE S2C. And
I am using xc8 to compile the code.
I send some characters to the PIC from the PC with an Xbee then I send a '/r', and the PIC has to return me the characters…

D.Martinez
- 11
- 2
1
vote
2 answers
Reading input pin of PIC18F
I am connecting a switch to PIC and I want to read that switch. I am using PIC18F4580. If the input pin is Low, then it will turn on an LED connected to another pin, configured as output. However, the LED keeps on the whole time, and the switch…

Fawaz
- 21
- 5
1
vote
0 answers
Programming PIC18F4520 stopwatch (MPLAB)
I'm making a code for PIC18F4520 stopwatch using a single 7 segment LED and 8 buttons. Button 1 to stop and button 2 to reset. The following is my code.
LIST p=18F4520
#include
CONFIG OSC = XT
CONFIG WDT = OFF
CONFIG LVP = OFF
CBLOCK…

Lucas
- 19
- 2
1
vote
2 answers
Delay by x microseconds in C for pic18f
I need an accurate time delay function written in C that delays the pic program execution by a given number of microseconds. I did find an example on microchipc.com which uses ASM, but the code only allows for clock speeds up to 32000000. My clock…

Huggzorx
- 144
- 1
- 13
1
vote
2 answers
I²C Master Write with PIC18F45K50 : keeps SCL low
I'm writing my own I²C Master Write function according to Microchip's datasheet. I'm using MPLAB X. I generated the configuration with the Code Configurator, but here are the interesting bits :
// R_nW write_noTX; P stopbit_notdetected; S…

ricothebrol
- 81
- 12
1
vote
1 answer
ADC for PIC18F47J53 code unexpected behavior when passing by value
I am implementing the ADC for PIC18F47J53 using MPLAB v3.51.
Why is the value of the variable CH in the main function not passed correctly to the function ADC_Read with the argument channel?
unsigned int ADC_Read(unsigned char channel);
void…

MFF
- 21
- 7