|
|
View previous topic :: View next topic |
Author |
Message |
technochrat
Joined: 22 Feb 2012 Posts: 2
|
PIC18f8722 UART not Functional |
Posted: Wed Feb 22, 2012 9:25 am |
|
|
Code: |
#include "C:\Users\SASH\Desktop\MASTER_THESIS\CCS\blah.h"
#fuses NOPUT,NOLVP, NOWRT, WDT512,NOPROTECT,NODEBUG,MCLR,HS,FCMEN,IESO
//#use delay(clock=10000000, crystal=10000000)
#use delay(clock=10000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,PARITY=N,BITS =8,UART1,STOP=1,STREAM=PC,ERRORS)
void main()
{
setup_adc_ports(AN0|VSS_VDD);
setup_adc(ADC_CLOCK_INTERNAL|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_uart(9600);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
printf("DEBUGPORT not working");
}
|
Hello all,
I am trying to implement a simple Debug port here. I have attached the code above.
I always miss the last 2 bytes on the PC terminal program.
If I send DEBUGPORT not working.
I receive DEBUGPORT not worki NULL.
What am I doing wrong? Any help is appreciated... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Wed Feb 22, 2012 9:29 am |
|
|
You would always miss the last two bytes.
You are letting the code drop off the end, which sends it to sleep. The hardware buffer still has two characters to send, so these are lost....
Best Wishes |
|
|
technochrat
Joined: 22 Feb 2012 Posts: 2
|
|
Posted: Wed Feb 22, 2012 9:44 am |
|
|
So what would be the corrective measure ? |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Wed Feb 22, 2012 10:17 am |
|
|
Add a while(1) loop at the end of main().
Nearly all PIC programs need such a loop. In most, of course, its where the main processing takes place, over and over and over...
RF Developer |
|
|
|
|
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
|