??? 04/11/07 13:12 Read: times |
#136981 - Status update Responding to: ???'s previous message |
Okay, back for round two. I stuck in the changes and optimizations that Mr. Kurzman gave me and cleared out the second serial port stuff. Code snapshot:
#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. } unsigned char serial1InIndex=0;//for queued serial comms unsigned char serial1OutIndex=0; unsigned char serial1InQueue[16];//data queued to go out on UART 0 unsigned char serial1OutQueue[16];//data queued to be processed from UART 0 //could maybe use bits for status indicators and check completion in main loop? unsigned char serial1InStatus=1;//1 for ready, 2 for in-progress, 3 for transaction complete but unserviced unsigned char serial1OutStatus=1;// /*int serial2InIndex=0; int serial2OutIndex=0; int serial2InQueue[16];//data queued to go out on UART 1 int serial2OutQueue[16];//data queued to be processed from UART 1 int serial2InStatus=1;//1 for ready, 2 for in-progress, 3 for transaction complete but unserviced int serial2OutStatus=1;//*/ static void serialOneService(void) interrupt 5{//services serial comms to and from scan tool TI_0=false; SBUF0=0x41; } //responses to first code unsigned char response1Array[5]={0x04, 0x08, 0xFF, 0x10, 0x02}; code unsigned char 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; while(1){ // if(serial1OutStatus==3){//handle the messages from the serial port } } The issue is now that the interrupt handler jumps into la-la land as soon as it's called (C:0x0023 F110 ACALL C:0710). The serial interrupt vector is 0x0023; there's nothing but a lot of NOPS at 0x0710. As this seems to be a compiler issue, and as I don't seem to have read the docs closely enough, I'm going to dive into the help files, "bible", User's Guide etc. Any ideas from someone who knows the Keil uVision IDE would be welcome. Heck, general suggestions are welcome too. Many Thanks, Bob Robertson |
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 |