|
|
View previous topic :: View next topic |
Author |
Message |
byatin
Joined: 26 Oct 2006 Posts: 10 Location: delhi -india
|
adc with porta & port b as digital on pic18f4550 |
Posted: Mon Oct 30, 2006 1:04 am |
|
|
hi, i am using pic18f4550 microcontroller , i have to use port a pins ra0,ra1 as a analog and all port b pins as digital ,can anybody help me how to do it. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 31, 2006 1:26 am |
|
|
Quote: | I am using pic18f4550 microcontroller , I have to use port
pins ra0, ra1 as analog and all port b pins as digital. |
Look at the 18F4550.H file. The file is in this directory:
c:\Program Files\Picc\Devices
Scroll down near the end of the file. You'll see a section with this title:
Code: |
// Constants used in SETUP_ADC_PORTS() are:
|
These are the settings that are used to configure pins as digital or Analog.
You said you're looking for a setting that will make pins A0 and A1 into
analog pins. Look in the list in the .H file. There is a setting for that.
Use that setting as a parameter in the setup_adc_ports() function.
If you want the Analog pins on Port B to be configured as digital pins
upon power-on reset, there is a fuse setting to do this. Add the setting
shown in bold below.
Quote: |
#include <18F4550.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT, NOLVP,NOPBADEN
#use delay(clock=4000000) |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|