??? 04/10/07 20:17 Read: times |
#136941 - "Newbie's" etc with indents |
Greetings, all. This is my first time working with microcontrollers, and it's quite a bit to soak up at once, although very cool. I'm an experienced programmer, comfortable in C/++ and semi-literate in assembly.
My trouble is that I'm trying to establish communications via the serial ports on a DS98C450. The serial ports have been set up correctly and have sent data. I've set both the general interrupt enable bit and the serial interrupt enable bits; to manually trigger a serial interrupt (for testing purposes) I have main() populating the serial buffer. This is successfully sent; the interrupt handler should then be called, send a character, and exit. Once that character is done being sent, the handler should be called again; the intended result is an infinite string of characters. I'm using the Keil uVision 3 environment to compile C code. Source follows: #include <DS89C4xx.h> #include <stdio.h> void initSerialPorts(){ EA=1;//enable interrupts ES0=1;//enable serial port interrupts ES1=1; SCON0= 0xD2;//put serial ports into mode 3 SCON1= 0xD2; TMOD |=0x20;//put timer 1 into mode 2 TH1=244;//value to set timer to after it rolls over TR1=1;//start timer 1 running TB8_0=0;//9th data bit SMOD_1=1;//doubler bits for both serial ports PCON |= 0x80; TI_0=1;//initialize transmission interrupt bits TI_1=1; EWDI = 0;//disable watchdog timer interrupt //CKMOD |= 0x08;//set input clock freq divider to 1 //CKCON |= 0x10;//don't care about value, but set it anyway. } int serial1InIndex=0;//for queued serial comms int serial1OutIndex=0; int serial1InQueue[16];//data queued to go out on UART 0 int serial1OutQueue[16];//data queued to be processed from UART 0 int serial1InStatus=1;//1 for ready, 2 for in-progress, 3 for transaction complete but unserviced int serial1OutStatus=1;// static void serialOneService(void) interrupt 5{//services serial comms to and from scan tool SBUF0=0x41; } //responses to first int response1Array[5]={0x04, 0x08, 0xFF, 0x10, 0x02}; int response2Array[5]={0x04, 0x6C, 0xF1, 0x10, 0x60}; int i=0; void main(void){ initSerialPorts(); //serial1OutQueue={0x04, 0x08, 0xFF, 0x10, 0x02}; for(i=0; i<5; i++){ serial1OutQueue[i]=response1Array[i]; } SBUF0=0x00; TI_0=1; while(1){ TI_0=1; } } I'll keep plugging on this, of course, but I'd appreciate any help someone more knowledgeable could lend. Many Thanks, Bob Robertson Edit: added indentation; thanks, Herr Malund. |
Topic | Author | Date |
"Newbie's" etc with indents | 01/01/70 00:00 | |
a recommendation and a question | 01/01/70 00:00 | |
am I missing something? | 01/01/70 00:00 | |
Re: missing something? | 01/01/70 00:00 | |
re: recc's and question | 01/01/70 00:00 | |
glossary | 01/01/70 00:00 | |
"bible" time | 01/01/70 00:00 | |
Where is the Interupt Handler? | 01/01/70 00:00 | |
re: handler location | 01/01/70 00:00 | |
re: actual handler location | 01/01/70 00:00 | |
Status update | 01/01/70 00:00 | |
that is problematic | 01/01/70 00:00 | |
re: Problematic. | 01/01/70 00:00 | |
just spotted this | 01/01/70 00:00 | |
re: Interrupt number | 01/01/70 00:00 | |
if you do like this (http://....) | 01/01/70 00:00 | |
re: interrupt *solution*![]() | 01/01/70 00:00 |