Programming the PIC18F4525

Status
Not open for further replies.

loup-garou

New Member
hi everybody,

I started programming the PIC18F4525 (same us PIC18F2525/2620/4620)using C18 compiler in MPLAB (C language),I compiled and simulated some simple codes (LED blinking in portB) , but when I tried to use the PORTA as an input, i got problems with simulation, cause the PORTA pins should be configurated as digitals or analogs, despite many attempts, i wasn't able to put them in digital.

I used codes that I found in the datasheet :
ADCON1<3:1>=1111 , ADCON1=6 and PCFG<3:0> = 1111


they are ignored by my compiler (syntax error) hence, I still have the problem, how can I figure it out please?


thanks in advance.



Rq: PORTB has aslo AN I/O but I disable it in the Configuration bits menu of MPLAB (those of PORTA aren't there) i solved also the PORTB problem with using LATB insted of PORTB, I know I can use LATA and the simulation will work, but I think I'd better write a code that clearly mention that the Anlog I/O are disabled (Digitals are enabled). take a look at the pin diagrams that I joined-my PIC is the 18F4525
 

Attachments

  • 18F4525-18F452.JPG
    164.2 KB · Views: 442
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…