Technical discussions about Freescale Microcontrollers: M68HC11. (Freescale Semiconductor is a Subsidiary of Motorola).
|
Hi, I am using the SCI to transmit from the micro to the PC via RS232. Does the vector at FFD6 & FFD8 (SCI serial system & SPI serial transfer complete) need to be initialised, I have not initialised it on my development system and it works fine. Thanks Bal |
|
|
|
You are probably getting away with that because your development system has already initialized the vector for you. Your program will most likely fail when you try to run stand alone. Bob --- Avoid computer viruses, Practice safe hex --- -- Specializing in small, cost effective embedded control systems -- http://www.smithmachineworks.com/embedprod.html Robert L. (Bob) Smith Smith Machine Works, Inc. 9900 Lumlay Road Richmond, VA 23236 804/745-2608 ----- Original Message ----- From: "bal_gill21" <> To: <> Sent: Sunday, February 06, 2005 11:26 AM Subject: [m68HC11] SCI vector > > Hi, > I am using the SCI to transmit from the micro to the PC via RS232. > Does the vector at FFD6 & FFD8 (SCI serial system & SPI serial > transfer complete) need to be initialised, I have not initialised it > on my development system and it works fine. > > Thanks > > Bal > -------------------------------------------------------------------------- ------ > Yahoo! Groups Links > > a.. To |
|
--- In , "Bob Smith" <bobsmith5@v...> wrote: > You are probably getting away with that because your development > system has already initialized the vector for you. > > Your program will most likely fail when you try to run stand alone. > ----- Original Message ----- > From: "bal_gill21" <bal_gill21@y... > I am using the SCI to transmit from the micro to the PC via RS232. > Does the vector at FFD6 & FFD8 (SCI serial system & SPI serial > transfer complete) need to be initialised, I have not initialised it > on my development system and it works fine. If the SCI is being used in strictly 'polled' mode, with SCI interrupts disabled, it is not *mandatory* to initialize the SCI vector, since the SCI interrupt (being disabled) will never be invoked. I have always considered it 'good practice' to initialize ALL of the interrupt and trap vectors supported by a given CPU. Interrupts that you are not using should point to some sort of generic 'inimplemented interrupt' routine. On my projects, this routine often consists of a few instructions that "do something visible" that will let me know that an unexpected interrupt has occured. This could be as simple as asserting or toggling a otherwise unused port pin. After performing the 'visible action', the routine ends with a branch instruction that branches to itself, effectively stopping the program. I don't use STOP or WAI because these instructions can be disabled or terminated under certain conditions. -- Mark |
|
I have sent what I wanted to over the RS232 and the correct length of data has been sent but the data is meaningless. It could be (or is) because I did not initialise the SCI. I would normally initialise it in the normal manner ie give the appropriate location in code a label (myLabel) and then initialise it at the end ie ORG $ffd6 ;vector for SCI FDB myLabel The problem is that i'm unsure where to label it because there is no place where the SCI actually starts. I have put some of my code below, I hope its legible and makes sense. Thanks guys Bal circle LDAA PORTC ;Read PORT C, bit 4 will be high when user has pressed button to download data CMPA #%00000111 BHI trnsmit ;Ready to transmit data JMP circle ;Signal not recieved to transmit from port C, so keep looping trnsmit LDAA #$30 ;Set bits SCP1 AND SCP0 to 1 in BAUD register for selection of 9600 STAA BAUD ;$102b LDAA #$0C ;Turn SCI on, TE=RE=1 (transmit & recieve) in SCCR2 register STAA SCCR2 LDX #DATASRT ;Initialise X register, start of first data address LDAA #$00 ;Set character length in the SCCR1,one START bit,8 DATA bits & 1 STOP bit STAA SCCR1 sndchr LDAA $00,x ;Load accumulator A with the next ASCII code to be transmitted LDAB SCSR ;Read SCSR register as first step in the clearing sequence of the TDRE bit STAA SCDR ;Send character to be transmitted into the TDR and clear TDRE INX ;Increment X CPX #DATASTP ;Last memory location for ASCCI code BEQ lstSrn ;If complete message transmitted, go to last screen (code carries on) chtdre LDAB SCSR ;Check if TDRE=1 to determine if the TDR is ready for next character BMI sndchr ;If tdre=1, transmit the next character JMP chtdre ;If tdre !=1, check TDRE again > > You are probably getting away with that because your development > > system has already initialized the vector for you. > > > > Your program will most likely fail when you try to run stand alone. > > > ----- Original Message ----- > > From: "bal_gill21" <bal_gill21@y...> > > > > > > I am using the SCI to transmit from the micro to the PC via RS232. > > Does the vector at FFD6 & FFD8 (SCI serial system & SPI serial > > transfer complete) need to be initialised, I have not initialised it > > on my development system and it works fine. > > If the SCI is being used in strictly 'polled' mode, with SCI > interrupts disabled, it is not *mandatory* to initialize the SCI > vector, since the SCI interrupt (being disabled) will never be invoked. > > I have always considered it 'good practice' to initialize ALL of the > interrupt and trap vectors supported by a given CPU. Interrupts that > you are not using should point to some sort of generic 'inimplemented > interrupt' routine. On my projects, this routine often consists of a > few instructions that "do something visible" that will let me know > that an unexpected interrupt has occured. This could be as simple as > asserting or toggling a otherwise unused port pin. After performing > the 'visible action', the routine ends with a branch instruction that > branches to itself, effectively stopping the program. I don't use > STOP or WAI because these instructions can be disabled or terminated > under certain conditions. > > -- Mark |
|
----- Original Message ----- From: "bal_gill21" <> To: < > ORG $ffd6 ;vector for SCI > FDB myLabel > > The problem is that i'm unsure where to label it because there is no > place where the SCI actually starts. I have put some of my code > below, I hope its legible and makes sense. Thanks guys You need to organize your code differently to use interrupts for the SCI. (You actually need to organize your code, regardless.) When using interrupts, in effect you're multitasking. Your main code is one task, the Interrupt Service Routine (ISR) is another. The two run in parallel without interfering with each other. Let's say you use interrupts only for RX, where they are mostly needed. (For now, you'll still do TX the simple way by calling the regular 'PutChar' routine.) For RX, you need to have a routine (your ISR) that will only do a very simply job: receive a character and place it in a queue. It shouldn't worry about anything else. It shouldn't even bother to see if anyone is interested for the received character at the moment. This will allow your program to receive characters asynchronously from the main program's demands for them. In your main program, every time you come to process another character from the SCI, you'll call a routine to de-queue the next available character (so your regular 'GetChar' routine will de-queue from the RX queue instead of polling SCSR to see if a character has arrived). Look inside http://www.aspisys.com/asm11d84.zip for the file ./SAMPLES/FRAME/OS11/SCI_INT.MOD You can compare the interrupt-driven version with an equivalent polled-mode version (./SAMPLES/FRAME/OS11/SCI.MOD). Hope this helps. > Bal |
|
My SCI is not interupt driven. I was using the ISR to log data every 15 minutes for 24 hours. The ISR is then turned off and the system waits for an input on PORTC. When the signal is recieved on PORTC all of the logged data is sent through the MAX232 chip and to the PC using the SCI all in one go. Data is sent to the PC ie the right length, but it does not display the numbers it is supposed to. Bal --- In , "Tony Papadimitriou" <tonyp@m...> wrote: > ----- Original Message ----- > From: "bal_gill21" <bal_gill21@y...> > To: < > > ORG $ffd6 ;vector for SCI > > FDB myLabel > > > > The problem is that i'm unsure where to label it because there is no > > place where the SCI actually starts. I have put some of my code > > below, I hope its legible and makes sense. Thanks guys > > You need to organize your code differently to use interrupts for the SCI. (You > actually need to organize your code, regardless.) > > When using interrupts, in effect you're multitasking. Your main code is one > task, the Interrupt Service Routine (ISR) is another. The two run in parallel > without interfering with each other. > > Let's say you use interrupts only for RX, where they are mostly needed. (For > now, you'll still do TX the simple way by calling the regular 'PutChar' > routine.) > > For RX, you need to have a routine (your ISR) that will only do a very simply > job: receive a character and place it in a queue. It shouldn't worry about > anything else. It shouldn't even bother to see if anyone is interested for the > received character at the moment. This will allow your program to receive > characters asynchronously from the main program's demands for them. > > In your main program, every time you come to process another character from the > SCI, you'll call a routine to de-queue the next available character (so your > regular 'GetChar' routine will de-queue from the RX queue instead of polling > SCSR to see if a character has arrived). > > Look inside http://www.aspisys.com/asm11d84.zip for the file > ./SAMPLES/FRAME/OS11/SCI_INT.MOD > > You can compare the interrupt-driven version with an equivalent polled-mode > version (./SAMPLES/FRAME/OS11/SCI.MOD). > > Hope this helps. > > > Bal > > tonyp@a... |
|
Bal, You may need to recheck the settings for the Com port on your computer. Also, What program are you using to display the data? If you are not already doing so, then use Hyperteminal, or the equivalent, in order to see what is really coming across the Com Port. If you are certain that the Com port settings are correct for Hyperterm, then you will be able to see exactly what the MCU is sending to the computer, however, if the settings are incorrect, then you may see a bunch of gobldygook. For a test, write a very simple program that sends perhaps a word to the computer with the same settings in your MCU code that you have now and see if this turns up correct. That's about all I can think of until we know how you are displaying the data on the Computer. LF bal_gill21 <> wrote: My SCI is not interupt driven. I was using the ISR to log data every 15 minutes for 24 hours. The ISR is then turned off and the system waits for an input on PORTC. When the signal is recieved on PORTC all of the logged data is sent through the MAX232 chip and to the PC using the SCI all in one go. Data is sent to the PC ie the right length, but it does not display the numbers it is supposed to. Bal --- In , "Tony Papadimitriou" <tonyp@m...> wrote: > ----- Original Message ----- > From: "bal_gill21" <bal_gill21@y...> > To: < > > ORG $ffd6 ;vector for SCI > > FDB myLabel > > > > The problem is that i'm unsure where to label it because there is no > > place where the SCI actually starts. I have put some of my code > > below, I hope its legible and makes sense. Thanks guys > > You need to organize your code differently to use interrupts for the SCI. (You > actually need to organize your code, regardless.) > > When using interrupts, in effect you're multitasking. Your main code is one > task, the Interrupt Service Routine (ISR) is another. The two run in parallel > without interfering with each other. > > Let's say you use interrupts only for RX, where they are mostly needed. (For > now, you'll still do TX the simple way by calling the regular 'PutChar' > routine.) > > For RX, you need to have a routine (your ISR) that will only do a very simply > job: receive a character and place it in a queue. It shouldn't worry about > anything else. It shouldn't even bother to see if anyone is interested for the > received character at the moment. This will allow your program to receive > characters asynchronously from the main program's demands for them. > > In your main program, every time you come to process another character from the > SCI, you'll call a routine to de-queue the next available character (so your > regular 'GetChar' routine will de-queue from the RX queue instead of polling > SCSR to see if a character has arrived). > > Look inside http://www.aspisys.com/asm11d84.zip for the file > ./SAMPLES/FRAME/OS11/SCI_INT.MOD > > You can compare the interrupt-driven version with an equivalent polled-mode > version (./SAMPLES/FRAME/OS11/SCI.MOD). > > Hope this helps. > > > Bal > > tonyp@a... Yahoo! Groups SponsorADVERTISEMENT document.write(''); --------------------------------- Yahoo! Groups Links To --------------------------------- |
|
Yes, I am actually using hyperterminal. The settings are exactly the way they should be because I have sent data to it using the development system and its fine. Using the actual hardware shows the data in a triagle shape in hyperterminal but the actual length of the data is being transmitted correctly. Bal --- In , bart homerson <odddooo1@y...> wrote: > Bal, > You may need to recheck the settings for the Com port on your computer. Also, What program are you using to display the data? If you are not already doing so, then use Hyperteminal, or the equivalent, in order to see what is really coming across the Com Port. If you are certain that the Com port settings are correct for Hyperterm, then you will be able to see exactly what the MCU is sending to the computer, however, if the settings are incorrect, then you may see a bunch of gobldygook. > > For a test, write a very simple program that sends perhaps a word to the computer with the same settings in your MCU code that you have now and see if this turns up correct. That's about all I can think of until we know how you are displaying the data on the Computer. > > LF > > bal_gill21 <bal_gill21@y...> wrote: > > My SCI is not interupt driven. I was using the ISR to log data every > 15 minutes for 24 hours. The ISR is then turned off and the system > waits for an input on PORTC. When the signal is recieved on PORTC all > of the logged data is sent through the MAX232 chip and to the PC > using the SCI all in one go. Data is sent to the PC ie the right > length, but it does not display the numbers it is supposed to. > > Bal > > --- In , "Tony Papadimitriou" <tonyp@m...> > wrote: > > ----- Original Message ----- > > From: "bal_gill21" <bal_gill21@y...> > > To: <> > > > > > > > ORG $ffd6 ;vector for SCI > > > FDB myLabel > > > > > > The problem is that i'm unsure where to label it because there is > no > > > place where the SCI actually starts. I have put some of my code > > > below, I hope its legible and makes sense. Thanks guys > > > > You need to organize your code differently to use interrupts for > the SCI. (You > > actually need to organize your code, regardless.) > > > > When using interrupts, in effect you're multitasking. Your main > code is one > > task, the Interrupt Service Routine (ISR) is another. The two run > in parallel > > without interfering with each other. > > > > Let's say you use interrupts only for RX, where they are mostly > needed. (For > > now, you'll still do TX the simple way by calling the > regular 'PutChar' > > routine.) > > > > For RX, you need to have a routine (your ISR) that will only do a > very simply > > job: receive a character and place it in a queue. It shouldn't > worry about > > anything else. It shouldn't even bother to see if anyone is > interested for the > > received character at the moment. This will allow your program to > receive > > characters asynchronously from the main program's demands for them. > > > > In your main program, every time you come to process another > character from the > > SCI, you'll call a routine to de-queue the next available character > (so your > > regular 'GetChar' routine will de-queue from the RX queue instead > of polling > > SCSR to see if a character has arrived). > > > > Look inside http://www.aspisys.com/asm11d84.zip for the file > > ./SAMPLES/FRAME/OS11/SCI_INT.MOD > > > > You can compare the interrupt-driven version with an equivalent > polled-mode > > version (./SAMPLES/FRAME/OS11/SCI.MOD). > > > > Hope this helps. > > > > > Bal > > > > tonyp@a... > > > Yahoo! Groups SponsorADVERTISEMENT > document.write(''); > > --------------------------------- > Yahoo! Groups Links > > To > > --------------------------------- |