Hi,
my problem is the same of Overdall, I have to send the result of ADC conversion with the SCI. I use polling for all my operation(SCI1S1_TDRE and ATDSC_CCF). My question is about the formula for the baude rate:
baud rate=(busclock)/((sbr12-0)*16)
I want to modify the bus clock and I have this formula
bus frequency=((firg/7)*P*N/R)
What's firg? What's the value of firg for MC13192SARDUG and for M68EVB908GB60UM?
Thanks a lot
Hi HCs08,
Presumably you want to use the internal clock mode FEI.
firg is the Frequency of the Internal Reference Generator.
In a 9S08GB/GT this is nominally 243kHz and you must trim it to be so by adjusting the value in ICGTRM until it is 243kHz
BR Peg
Hi HCs08,
Firstly, writing to address SCI1D is all you have to do to send a byte out over SCI.
One thing to note is reading from this same address gives you the recieved register so the |= is probably not going to do what you expect.
You must however have initialised the SCI correctly before you can just write to SCI1D and expect it to work.
First you need to write to SCI1BDH and SCI1BDL to set the baudrate depending on your clock.
You can probably leave SCI1C1 at reset default of 0x00.
But you must at least set bit 3 in SCI1C2 for transmit enable and possibly bit 2 for receive enable.
Hope this helps.
BR Peg
BTW, please don't post the same Q in multiple forums and don't post Q's about devices in the general forum, you will only annoy people.
Message Edited by peg on 04-22-200601:01 PM
Hi,
Because the transmitter is double buffered you put a byte into SCID and it will automatically move it into the shift register when it can. So you just wait for TDRE to be set which means that this has occurred. You can then load SCID while it is busy shifting the previous byte out. This way you can easily achieve continuous transmission. TC gets set when the last bit has left the shift register.
This means that if you need to send several bytes you load the first one into SCID then wait for TDRE (which will be almost instantaneous the first time) then load the next byte into SCID then wait for TDRE etc...... You don't normally need to check for TC, only if you need to for instance disable the transmitter of a half duplex RS-485 line.
BR Peg
Message Edited by peg on 04-24-200611:04 PM
Hi Odddlaw,
SCTIE is the interrupt enable for SCTE which is the same as TDRE in a GB as described in my previous post. And TCIE is the interrupt enable for TC as in previous post.
You seem to be unsure of what you are doing with both interrupts in general and with using the SCI. I would suggest you get the SCI going in polled mode first to remove one layer of complexity.
Your answer to Q2 is found by using the info above combined with my previous post.
You don't need to use interrupts with the ADC because the conversion will be much quicker than to send the result over the SCI.
I would suggest this as a concept to start with.
cause a conversion
when complete (polled)
write result to SCI (just low byte for now to make it easy)
cause a conversion
when complete
* write to SCI
cause conversion
wait for SCTE
loop back to *
when you have that working you can put the stuff in the loop in a SCI interrupt routine so you can go and do something else.
This concept relies on the fact that sending one byte will take longer than 1 conversion so you don't need to wait for the conversion to end.
Let us know how you go!
BR Peg
Message Edited by peg on 04-26-200603:59 PM
when you have that working you can put the stuff in the loop in a SCI interrupt routine so you can go and do something else.
Hi,
To change my example above to interrupt:
1. Write ISR instead of loop:
read SCIxS1 ;to clear flag
write (ATD result low) to SCI
cause conversion
RTI
2. put the address of above routine into SC1x transmit vector.
3. Enable interrupts and set TIE in SCIxC2
4. Sit back and watch it work!
BR Peg