View previous topic :: View next topic |
Author |
Message |
starfire151
Joined: 01 Apr 2007 Posts: 195
|
UART1 interface with PIC24EP128GP202 |
Posted: Wed Mar 19, 2014 3:43 pm |
|
|
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
|
|
Posted: Thu Mar 20, 2014 9:28 am |
|
|
Found a hardware problem (disconnected wire).
All is well with the universe now
I even have the ISR working correctly. |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Thu Mar 20, 2014 11:38 am |
|
|
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
|
|
Posted: Thu Mar 20, 2014 12:00 pm |
|
|
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 |
|
|
|