Hi,
I want to display the 'U' character 5 times on the virtual terminal.
I have set the baud rate as 19200 and also changed it on the virtual terminal as it was displaying wrong characters to baud rate set as 9600 (default).
I have to set the micro at 20Mhz and I still I am getting 5 dashes ----- instead of UUUUU.
Can you help and explain why I am getting this?
The source code is:
#pragma config OSC = HS //set Osc mode to HS high speed clock
#pragma config WDT = OFF // set watchdog timer off
#pragma config LVP = OFF // Low Voltage Programming Off
#pragma config DEBUG = OFF // Compile without extra Debug compile Code
// Include Files
#include <p18f4520.h> // Device used is the PICF4520
#include <delays.h> // Include delays headers
void main (void)
{
TXSTA = 0x24;// Select high baud rate, 8 bit
SPBRG = 64;// 19200 bps, 20MHz clock
TXSTAbits.TXEN = 1;// Transmit enable
RCSTAbits.SPEN = 1; // Enable serial port
while(1){
while (PIR1bits.TXIF == 0) {;} // Wait until Peripheral Interrupt Request Register Transmit Flag is set // (transmit complete, TXREG empty)
TXREG = 'U';
Delay10KTCYx(50);
}
}
I want to display the 'U' character 5 times on the virtual terminal.
I have set the baud rate as 19200 and also changed it on the virtual terminal as it was displaying wrong characters to baud rate set as 9600 (default).
I have to set the micro at 20Mhz and I still I am getting 5 dashes ----- instead of UUUUU.
Can you help and explain why I am getting this?
The source code is:
#pragma config OSC = HS //set Osc mode to HS high speed clock
#pragma config WDT = OFF // set watchdog timer off
#pragma config LVP = OFF // Low Voltage Programming Off
#pragma config DEBUG = OFF // Compile without extra Debug compile Code
// Include Files
#include <p18f4520.h> // Device used is the PICF4520
#include <delays.h> // Include delays headers
void main (void)
{
TXSTA = 0x24;// Select high baud rate, 8 bit
SPBRG = 64;// 19200 bps, 20MHz clock
TXSTAbits.TXEN = 1;// Transmit enable
RCSTAbits.SPEN = 1; // Enable serial port
while(1){
while (PIR1bits.TXIF == 0) {;} // Wait until Peripheral Interrupt Request Register Transmit Flag is set // (transmit complete, TXREG empty)
TXREG = 'U';
Delay10KTCYx(50);
}
}