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

UART1 interface with PIC24EP128GP202

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



Joined: 01 Apr 2007
Posts: 195

View user's profile Send private message

UART1 interface with PIC24EP128GP202
PostPosted: Wed Mar 19, 2014 3:43 pm     Reply with quote

PCWHD V4.137.
CCSLOAD V4.053
CCSLOAD F/W V3.01

I finally have a baseline code toggling an LED. I even incorporated a timer1 ISR to toggle the LED and that works, too.

I tried to map the UART1 (U1TX and U1RX) pins and output a start-up message on power-up but it doesn't output anything. I think the clock is running right since the LED toggle period is correct.

The program is as follows:

Code:

#include <24EP128GP202.h>

#build (stack=0x4f80:0x4ffe)

#FUSES NOWDT                   
#FUSES NOPROTECT
#fuses NODEBUG
#FUSES OSCIO
#FUSES NOIOL1WAY
#FUSES NOJTAG                   
#FUSES NOCKSNOFSM
#FUSES ICSP3

#use delay(internal=29.48MHz) //for simplicity select multiple of 7.37MHz

#pin_select U1TX=PIN_B3
#pin_select U1RX=PIN_B2
#use rs232(baud=38400, parity=N, UART1, bits=8, errors)

#define HEARTBEAT PIN_A4

void main()
{
   setup_adc(ADC_OFF);
   setup_vref(VREF_DISABLED);
   setup_timer1(TMR_DISABLED);

   delay_ms(1000);
   
   printf("PIC24EP128GP202 Testbed\r\n");

   while(TRUE)
   {
      output_toggle(HEARTBEAT);
      delay_ms(1000);
   }
}


I eventually would like to run the UART1 interface with a #INT_RDA ISR but I'm taking baby steps and just trying to get an output first...

I'm seeing no output on the U1TX pin. It is high all the time after power-up. The U1RX pin stays low all the time.

How do I select specific pins for the UART1 that can be used for the #INT_RDA ISR, also.

Where does it specify the symbols used to specify clock divisor and multiplier? I think the divisor is CLKDIV but what is the multiplier called? I didn't see any reference to these values in the reference manual.

Thanks.
starfire151



Joined: 01 Apr 2007
Posts: 195

View user's profile Send private message

PostPosted: Thu Mar 20, 2014 9:28 am     Reply with quote

Found a hardware problem (disconnected wire).

All is well with the universe now Laughing

I even have the ISR working correctly.
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Thu Mar 20, 2014 11:38 am     Reply with quote

As Steve Ciarcia used to say "my favorite programming language is solder" - been there, done that. Glad you found the problem.

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Mar 20, 2014 12:00 pm     Reply with quote

Nice to hear it's 'up and running' ! I gave up trying to solder SMT devices, way
too itty bitty for my tired eyes.
INK was a great magazine,had a charter subscription, lots of PIC articles. I even have the semi log tractor trailer from a magazine shoot !


just be sure to backup WORKING code.

cheers
jay
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