gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
16F1827 software uart problem ... [SOLVED] |
Posted: Mon Jul 11, 2011 12:54 pm |
|
|
Greetings all - I'm running into a problem getting the software uart function to work correctly with a PIC16f1827 - compiler 4.114.
Simple little routine that sets up the PWM (which works), flashes a LED (which works) and sends a message out on pin b7 (which does not work). Don't see any activity on B7, but I do see a burst of data on B2. I need it on B7 for the UART Tool in the pickit2 to see it. Here is the program I have that should work (same format as I used in a 18F14k22 processor). Something obvious I am missing or is this a bug in the compiler ?
Code: |
#include <main.h>
#use rs232(baud=9600, xmit=PIN_B7, rcv=PIN_B6, ERRORS, PARITY=N, \
BITS=8, STREAM=MIKEYMON)
void main()
{
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
// config ccp1 for pwm using timer 2
output_low(PIN_B3); // Set CCP1 output low
setup_ccp1(CCP_PWM); // Configure CCP1 as a PWM
setup_timer_2(T2_DIV_BY_16, 255, 1); // Setup for 1.95khz
set_pwm1_duty(128); // 50% duty cycle
//Example blinking LED program
while(true){
output_low(LED0);
delay_ms(DELAY);
output_high(LED0);
delay_ms(DELAY);
fprintf(MIKEYMON,"test message from mikey\r\n");
}
}
|
_________________ 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
Last edited by gpsmikey on Mon Jul 11, 2011 1:07 pm; edited 1 time in total |
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Mon Jul 11, 2011 1:07 pm |
|
|
It was a compiler bug - updated to version 4.118 that I had downloaded within my 60 days, and same code now works as expected :-)
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 |
|