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


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | Piclist | interrupt called getc()


Advertise Here

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.

interrupt called getc() - sirtiffguy - Nov 29 4:16:00 2004


Hello,

I've just spent a *very* long time fooling around with a rs232
asyncronous reciever on an RB interrupt. The interrupt looks
something like this:

#int_RB
void RxChar() // input through RB7
{

INTCON.RBIE=0;
RCREG_X=fgetc(MCP_rs232);
restart_wdt();

INTCON.RBIF=0;
INTCON.RBIE=1;
INTCON.GIE=1;
}

The fastest I can get the baud rate without getting errors is 19200
on an 11059200 Hz clock. An example is recieving A2 when in fact it
is a 44. And a 8A when in fact it is a 15 (all in hex).

Heres what i suspect:
In rs232, LSB is sent first. 0x44 = 0b01000100 0xA2 = 0b10100010
When in rs232 the order is then flipped
so 0b01000100 -> 00100010... comparing this to 0xA2 as it would
appear over a rs232 line is 01000101.

01000101 ... the A2 in reverse order (what i got)
00100010 ... the 44 in reverse order (what i expected)

It looks rather simple to fix (just shift it right and throw on a
zero), but is there a better way to fix this problem without
creating my own getc()? Im not sure what would happen if the rs232
value had a leading 1, ie 10110101... probably blow up. BTW: the 15
and 8A works the exact same way.

I'm also thinking that if i were to increase my clock speed (while
keeping it a nice multiple of 9600) then that might also remedy the
problem.

Chris



______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


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