CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

What am I Missing? 24EP64GP202

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
gtx15



Joined: 19 May 2018
Posts: 27

View user's profile Send private message

What am I Missing? 24EP64GP202
PostPosted: Wed Oct 16, 2019 6:47 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Oct 16, 2019 8:27 pm     Reply with quote

gtx15 wrote:
32mhz crystal

Look at page 414 of the PIC data sheet.
http://ww1.microchip.com/downloads/en/DeviceDoc/70000657H.pdf
It shows that for HS mode, the highest crystal frequency it can run is
25 MHz. You need to get a lower frequency crystal.
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Thu Oct 17, 2019 2:35 am     Reply with quote

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....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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