Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 8th May 2008, 06:55 AM   (permalink)
Experienced Member
loup-garou is on a distinguished road
Talking Programming the PIC18F4525

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
Attached Images
File Type: jpg 18F4525-18F452.JPG (164.2 KB, 8 views)

Last edited by loup-garou; 8th May 2008 at 07:05 AM.
loup-garou is offline   Reply With Quote
Old 8th May 2008, 07:33 AM   (permalink)
Experienced Member
Pommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to behold
Default

ADCON1=0x0f should set all ports to digital.

Mike.
Pommie is offline   Reply With Quote
Old 8th May 2008, 12:57 PM   (permalink)
Experienced Member
loup-garou is on a distinguished road
Default

Quote:
Originally Posted by Pommie
ADCON1=0x0f should set all ports to digital.

Mike.

thank you Pommie.
loup-garou is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
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



All times are GMT. The time now is 05:35 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.