![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Experienced 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 Last edited by loup-garou; 8th May 2008 at 07:05 AM. |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
ADCON1=0x0f should set all ports to digital.
Mike. |
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
thank you Pommie. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Errors while programming a PIC16F874A | Kitt0s | Micro Controllers | 17 | 8th March 2008 07:12 PM |
| Question about Inchworm+ | Quan | Micro Controllers | 54 | 28th October 2007 12:20 AM |
| UNIT Committment solution using Dynamic programming | arijit18 | Electronic Projects | 1 | 18th October 2007 08:27 PM |
| Programming languages | sram | General Electronics Chat | 9 | 2nd March 2007 04:14 PM |
| Good Computer Programming Book | ThermalRunaway | Chit-Chat | 21 | 16th September 2005 10:05 PM |