Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Discussion Groups

Discussion Groups | Piclist | PIC18F8680 and USART

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

PIC18F8680 and USART - Piotr Piwko - Jan 11 18:40:27 2008


Hello.

I try to use USART Iterface, so I initiate it:

RCSTA |= (1<<7); // SPEN, Serial Port Enable
TRISC |= 0xC0; // Piny RC6 i RC7
TXSTA &= ~(1<<6); // TX9, 8-bit transmission
TXSTA |= (1<<5); // TXEN, Transmission enabled
TXSTA &= ~(1<<4); // SYNC, Asynchronous mode
TXSTA &= ~(1<<3); // SENDB, Sync break transmission completed
RCSTA &= ~(1<<6); // RX9, 8-bit reception
RCSTA |= (1<<4); // CREN, Enables receiver
BAUDCON |= (1<<1); // WUE, Wake-up Enable
BAUDCON &= ~(1<<0); // ABDEN, Auto-baud detect disable
SPBRG = 12; // Baud rate 9600, Fosc = 8MHz
TXSTA &= ~(1<<2); // BRGH, Low speed
BAUDCON &= ~(1<<3); // BRG16, 8-bit Baud Rate Generator

My transmit function is:

void usart_send(char value)
{
while(!PIR1bits.TXIF);
TXREG = value;
while(!TXSTAbits.TRMT);
}

I don't know why, but I always get on my terminal only first two byte
and some 0x00. After that, program suspends on checking TRMT bit.

Thanks in advance for any help.

--
Peter
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )