|
|
View previous topic :: View next topic |
Author |
Message |
gtx15
Joined: 19 May 2018 Posts: 27
|
What am I Missing? 24EP64GP202 |
Posted: Wed Oct 16, 2019 6:47 pm |
|
|
Just starting to program this device and I can't get it to do anything. I'm able to program it and I'm using 3.3v ps., 32mhz crystal and a VCap from Pin 19 to pin 20. Voltage on pin 2 or 3 is .7v looks like its floating. Any help would be great.
Code: |
#include <erase.h>
void main()
{
//Example blinking LED program
while(true)
{
output_low(LED);
delay_ms(DELAY);
output_high(LED);
delay_ms(DELAY);
output_low(test);
delay_ms(DELAY);
output_high(test);
delay_ms(DELAY);
}
}
|
Code: |
#include <24EP64GP202.h>
#device ICSP=1
#use delay(crystal=32000000)
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOJTAG //JTAG disabled
#FUSES CKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#use FIXED_IO( A_outputs=PIN_A1 )
#define test PIN_A1
#define LED PIN_A0
#define DELAY 1000 |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Thu Oct 17, 2019 2:35 am |
|
|
Also, remember the MCLR pin does need to be pulled up.
Depending on your compiler version (recent compiler automatically do
this, but older ones did not), you may need to disable analog functions
before pins can be used for digital I/O. So:
setup_adc_ports(NO_ANALOGS);
or if you are using the ADC just setup the analog pins you are going to use,
before attempting I/O.
Remember you can just run with the internal oscillator, so:
#use delay(INTERNAL=32MHz)
Not as accurate as a crystal, but will allow you to get started.
Key thing is that you can run at 32MHz (or more), with a crystal of 8MHz,
16MHz, 12MHz etc.. Anything that is a multiple of 4MHz, since this can then
be divided to give 4MHz to the PLL, which can then multiply this to
give a frequency between 120, and 340MHz, which can then be divided
by 2, 4 or 8 to feed the CPU.
Final thing though (and the reason it won't work), you are setting PortA
to use 'fixed IO', and then not setting pin A0 as an output. It'll therefore
be programmed as an input, so the LED won't work.... |
|
|
|
|
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
|