The PIC18 series 8 bit microcontrollers manufactured by Microchip Technology.
Questions tagged [pic18]
230 questions
0
votes
1 answer
How to flash the LED with push button - pic18f
I made a simple circuit to blink an LED, but the code does not work in proteus simulation. See the code and the simulation below.
#INCLUDE "P18F2550.INC"
CONFIG WDT=OFF
CONFIG OSC=HS
CONFIG LVP=OFF
R2 EQU 0x2
R3 EQU 0x3
R4 EQU 0x4
ORG…

Ronald Araújo
- 1,395
- 4
- 19
- 30
0
votes
2 answers
1wire problem in detail
I have defined these functions below, and when I ask Device_ID function for example of
the family code, I only get FF (should be 28), acctually I get both the family code, 48-bit serial, and the crc 8 bit to be all "ones". It seems like the detect…

Christian
- 1,548
- 2
- 15
- 26
0
votes
0 answers
Converting 0-5v analog to a rotary encoder equivalent
I'm currently working on a robot as an intern and must choose replacement drivers for the motors. The position information of the axis are given by analog pot. I do have 3 drivers by technosoft that needs a rotary encoder (quadrature) information to…
0
votes
2 answers
Timer is not counting on sleep mode with PIC18F?
I have PIC18F87J11 with MPLAB C18. I am trying to limit the consumption of battery by the device by forcing it to go to sleep. I noticed upon entering the sleep mode, timer0 stops counting up any further until awaken. Also the only method I know to…

Ammar
- 1,203
- 5
- 27
- 64
0
votes
2 answers
Long Delay using Delay Functions from C18 Libraries for PIC18
I'm using a PIC18 with Fosc = 10MHz. So if I use Delay10KTCYx(250), I get 10,000 x 250 x 4 x (1/10e6) = 1 second.
How do I use the delay functions in the C18 for very long delays, say 20 seconds? I was thinking of just using twenty lines of…

Michael Reed
- 13
- 1
- 5
0
votes
7 answers
How do you write and read to memory with PIC18?
I want to store a number to PIC18 then retain it even if the power is lost or the unit is reset. I think my writing code portion looks fine, just the reading portion of it looks strange after the unit is reset.
I am using the following code which I…

Ammar
- 1,203
- 5
- 27
- 64
0
votes
1 answer
Getting Array Values from the user on PIC18?
First let me show what's working then I will show what's not working. This code gives the right result.
unsigned long timeOn;
long d[10];
d[0] = 8;
d[1] = 6;
d[2] = 0;
d[3] = 0;
d[4] = 0;
timeOn = 10000*d[0] + 1000*d[1] + 100*d[2] + 10*d[3] + …

Ammar
- 1,203
- 5
- 27
- 64
0
votes
0 answers
PIC 18 / RS232 receive
I am trying to receive some data from an RS232 connection (9600 kbps - sending "s" while(1) ( and tested on hyperterminal ) )
I am using p18F8722 and writing in c the following on the processor:
Open1USART ( USART_TX_INT_OFF & USART_RX_INT_OFF &…

user2274358
- 1
- 1
- 1
0
votes
1 answer
RS232 communication in MPlab
I am using MPlab to read data from a pic micro controller. I am using pic18F87J11.
The data that I want to read is on pin 3 of the DB9 of the RS232, and my RS232 is connected to the pic micro controller.
Can anyone help me or give me a simple sample…

user2226775
- 1
- 1
- 2
0
votes
1 answer
Bit-banged serial on PIC stops working with nested loop in C
Stackoverflow, you've helped me before, I think I need your help again. I'm trying to bit-bang my own serial out using a GPIO on a PIC18F2550. This connects to some shift registers (3x74LS595), where the last one connects to a standard HD44780 LCD.…

BB ON
- 251
- 1
- 3
- 15
0
votes
1 answer
PIC Micro computer - using timer 3 as asyn counter - pull up
I am using a PIC18(L)F1XK22. I'm trying to use timer 3 as a synchronous counter.
The PIC is running using the internal oscillator.
CONFIG FOSC = IRC ; Internal oscillator
This should turn off use of pin RA5 as an external…

Mike D
- 2,753
- 8
- 44
- 77
0
votes
1 answer
PIC18F2550 Memory game PIC C18 programming LED off
I am using MPLAB C18 compiler to write c code for a PIC18F2550 which is to control a memory game. The user is to repeat a sequence of flashing LEDs by pressing corresponding buttons. A bit like a old Simon game but with a sequence just happening…

user1912837
- 1
- 1
0
votes
1 answer
Hitech C data buffers in program memory
The C18 compiler allows variables in program memory with ROM qualifier, but the Hi-Tech C seems rather reluctant to utilize the Havard architecture to its best. So is there a way to create data buffers in program memory with the Hi-Tech C compiler…

Vishnu
- 33
- 4
0
votes
1 answer
Microchip: How to load more then one HEX file in MPLAB X
I use MPLAB X (sometime MPLAB 8) and i get some project to finish. I have these HEX files:
bootloader.hex
magic_flag.hex
Bootloader is loaded from address 0x0 to 0x7FF. The magic flag has position in address 0x40 (so in bootloader area).
And now I…

Lodhart
- 635
- 2
- 9
- 13
0
votes
1 answer
PIC18f4620 Receive usart in SDCC
I'm trying to realize the communication of the PC (linux) with a PIC18F4620 for rs232. The Transmition (PIC -> to PC is fine). However, when I try to pass somenthing from the PC to PIC the PIR1bits.RCIF flag is never set and the interrupt does NOT…

Yuri Kaszubowski Lopes
- 543
- 1
- 4
- 11