Hello can anyone tell me what's the simplest way to make a 9600 hz
oscillator with the bx24?
the built-in timer apparently can't do it. maybe i can manipulate com3
into doing it if i set it at 19200. but does the com3 protocol include
a start bit?
hmmmm....
thanx anyone, louie
9600 hz oscillator with the bx-24?
Started by ●January 23, 2007
Reply by ●January 23, 20072007-01-23
> ... 9600Hz...
Try:
sub Square9600onPin27()
const F as single = 9600.0 '9600Hz on pin 27
dim lTCount as long
call putpin(27, 1) 'init pin 27 high
lTCount = clng(0.5 * 7372800.0 / F)
register.OCR1AH = cbyte(lTCount \ 256) 'set match count
register.OCR1AL = cbyte(lTCount mod 256)
register.TCCR1A = bx0001_0000 'toggle OC1b, pin 27
register.TCCR1B = bx0000_1001 'clr, xtal/1
end sub
Timers are described in the ATmega8535 processor documentation.
You should be able to do the same with pin 26 (OC1a from Timer1) and pin
25 (OC2 from Timer 2). Remember that the timers are used to support
some functions. COM3, for example, needs Timer2 so you can't use pin 25
as a timer output if you use COM3 on any pin, and Timer1 is needed by
PulseIn and others.
Tom
Try:
sub Square9600onPin27()
const F as single = 9600.0 '9600Hz on pin 27
dim lTCount as long
call putpin(27, 1) 'init pin 27 high
lTCount = clng(0.5 * 7372800.0 / F)
register.OCR1AH = cbyte(lTCount \ 256) 'set match count
register.OCR1AL = cbyte(lTCount mod 256)
register.TCCR1A = bx0001_0000 'toggle OC1b, pin 27
register.TCCR1B = bx0000_1001 'clr, xtal/1
end sub
Timers are described in the ATmega8535 processor documentation.
You should be able to do the same with pin 26 (OC1a from Timer1) and pin
25 (OC2 from Timer 2). Remember that the timers are used to support
some functions. COM3, for example, needs Timer2 so you can't use pin 25
as a timer output if you use COM3 on any pin, and Timer1 is needed by
PulseIn and others.
Tom
Reply by ●January 30, 20072007-01-30
thanks, Tom, for the routine. that's REALLY helpful. i just
couldn't
figure out how to configured the TC like that.
the plan is to set pin 25 oscillating, then connect it to pin 17, then
use the shiftout function to clock out a series of bits on pin 20.
like this:
Dim x As Byte
Call PutPin(17, bxOutputHigh)
call sub Square9600onPin25()
Call ShiftOut(20, 17, 8, x)
problem is, i gotta put 30 bits on the wire, and shiftout only does 8
at a time. i'm gonna check the atmel docs to see if i can directly
program the SPI to do what i want.
mike
> sub Square9600onPin27()
> const F as single = 9600.0 '9600Hz on pin 27
> dim lTCount as long
> call putpin(27, 1) 'init pin 27 high
> lTCount = clng(0.5 * 7372800.0 / F)
> register.OCR1AH = cbyte(lTCount \ 256) 'set match count
> register.OCR1AL = cbyte(lTCount mod 256)
> register.TCCR1A = bx0001_0000 'toggle OC1b, pin 27
> register.TCCR1B = bx0000_1001 'clr, xtal/1
> end sub
>
> Timers are described in the ATmega8535 processor documentation.
>
> You should be able to do the same with pin 26 (OC1a from Timer1) and
pin
> 25 (OC2 from Timer 2). Remember that the timers are used to support
> some functions. COM3, for example, needs Timer2 so you can't use
pin 25
> as a timer output if you use COM3 on any pin, and Timer1 is needed by
> PulseIn and others.
> Tom
>
figure out how to configured the TC like that.
the plan is to set pin 25 oscillating, then connect it to pin 17, then
use the shiftout function to clock out a series of bits on pin 20.
like this:
Dim x As Byte
Call PutPin(17, bxOutputHigh)
call sub Square9600onPin25()
Call ShiftOut(20, 17, 8, x)
problem is, i gotta put 30 bits on the wire, and shiftout only does 8
at a time. i'm gonna check the atmel docs to see if i can directly
program the SPI to do what i want.
mike
> sub Square9600onPin27()
> const F as single = 9600.0 '9600Hz on pin 27
> dim lTCount as long
> call putpin(27, 1) 'init pin 27 high
> lTCount = clng(0.5 * 7372800.0 / F)
> register.OCR1AH = cbyte(lTCount \ 256) 'set match count
> register.OCR1AL = cbyte(lTCount mod 256)
> register.TCCR1A = bx0001_0000 'toggle OC1b, pin 27
> register.TCCR1B = bx0000_1001 'clr, xtal/1
> end sub
>
> Timers are described in the ATmega8535 processor documentation.
>
> You should be able to do the same with pin 26 (OC1a from Timer1) and
pin
> 25 (OC2 from Timer 2). Remember that the timers are used to support
> some functions. COM3, for example, needs Timer2 so you can't use
pin 25
> as a timer output if you use COM3 on any pin, and Timer1 is needed by
> PulseIn and others.
> Tom
>
Reply by ●January 30, 20072007-01-30
Hello Mike,
This might work for you:
32-bit serial data buffer IC: RSB509b
Here is the data sheet: http://www.protean-logic.com/PDFs/Rsb509b2.pdf
The data sheet has connection diagrams as well as sample BS2 code
(which you can easily convert for your BX chip. In that sample, it
shows the RSB509B as a receive buffer for the MAX232 to BS2, in your
case you would reverse this to buffer the 30 bits, then use a signal
line from your uC to send the data to your device from the buffer.
The buffer operates at a native 9600bps and is TTL level.
I am not sure what you are trying to send data to... Most devices
would drop the extra bits after their receive buffers are full, so
you would only need to shift bits twice (LSL, LSL) on a DWORD value
then peek the bytes out for transmission...
Hope that helps!
J
--- In b..., "spillikinaerospace"
wrote:
>
> thanks, Tom, for the routine. that's REALLY helpful. i just couldn't
> figure out how to configured the TC like that.
> the plan is to set pin 25 oscillating, then connect it to pin 17,
then
> use the shiftout function to clock out a series of bits on pin 20.
> like this:
>
> Dim x As Byte
> Call PutPin(17, bxOutputHigh)
> call sub Square9600onPin25()
> Call ShiftOut(20, 17, 8, x)
>
> problem is, i gotta put 30 bits on the wire, and shiftout only does
8
> at a time. i'm gonna check the atmel docs to see if i can directly
> program the SPI to do what i want.
>
> mike
>
> > sub Square9600onPin27()
> > const F as single = 9600.0 '9600Hz on pin 27
> > dim lTCount as long
> > call putpin(27, 1) 'init pin 27 high
> > lTCount = clng(0.5 * 7372800.0 / F)
> > register.OCR1AH = cbyte(lTCount \ 256) 'set match count
> > register.OCR1AL = cbyte(lTCount mod 256)
> > register.TCCR1A = bx0001_0000 'toggle OC1b, pin 27
> > register.TCCR1B = bx0000_1001 'clr, xtal/1
> > end sub
> >
> > Timers are described in the ATmega8535 processor documentation.
> >
> > You should be able to do the same with pin 26 (OC1a from Timer1)
and
> pin
> > 25 (OC2 from Timer 2). Remember that the timers are used to
support
> > some functions. COM3, for example, needs Timer2 so you can't use
> pin 25
> > as a timer output if you use COM3 on any pin, and Timer1 is
needed by
> > PulseIn and others.
> >
> >
> > Tom
>
This might work for you:
32-bit serial data buffer IC: RSB509b
Here is the data sheet: http://www.protean-logic.com/PDFs/Rsb509b2.pdf
The data sheet has connection diagrams as well as sample BS2 code
(which you can easily convert for your BX chip. In that sample, it
shows the RSB509B as a receive buffer for the MAX232 to BS2, in your
case you would reverse this to buffer the 30 bits, then use a signal
line from your uC to send the data to your device from the buffer.
The buffer operates at a native 9600bps and is TTL level.
I am not sure what you are trying to send data to... Most devices
would drop the extra bits after their receive buffers are full, so
you would only need to shift bits twice (LSL, LSL) on a DWORD value
then peek the bytes out for transmission...
Hope that helps!
J
--- In b..., "spillikinaerospace"
wrote:
>
> thanks, Tom, for the routine. that's REALLY helpful. i just couldn't
> figure out how to configured the TC like that.
> the plan is to set pin 25 oscillating, then connect it to pin 17,
then
> use the shiftout function to clock out a series of bits on pin 20.
> like this:
>
> Dim x As Byte
> Call PutPin(17, bxOutputHigh)
> call sub Square9600onPin25()
> Call ShiftOut(20, 17, 8, x)
>
> problem is, i gotta put 30 bits on the wire, and shiftout only does
8
> at a time. i'm gonna check the atmel docs to see if i can directly
> program the SPI to do what i want.
>
> mike
>
> > sub Square9600onPin27()
> > const F as single = 9600.0 '9600Hz on pin 27
> > dim lTCount as long
> > call putpin(27, 1) 'init pin 27 high
> > lTCount = clng(0.5 * 7372800.0 / F)
> > register.OCR1AH = cbyte(lTCount \ 256) 'set match count
> > register.OCR1AL = cbyte(lTCount mod 256)
> > register.TCCR1A = bx0001_0000 'toggle OC1b, pin 27
> > register.TCCR1B = bx0000_1001 'clr, xtal/1
> > end sub
> >
> > Timers are described in the ATmega8535 processor documentation.
> >
> > You should be able to do the same with pin 26 (OC1a from Timer1)
and
> pin
> > 25 (OC2 from Timer 2). Remember that the timers are used to
support
> > some functions. COM3, for example, needs Timer2 so you can't use
> pin 25
> > as a timer output if you use COM3 on any pin, and Timer1 is
needed by
> > PulseIn and others.
> >
> >
> > Tom
>
Reply by ●February 2, 20072007-02-02
thanx, Jay, that helps quite alot. i had no idea that such a device
existed. it looks like it would work nicely, although i'll need to
check thier docs to be sure.
at this point i haven't precisely worked out the protocol to talk to
my pda, but i do know that i will have to do the bit bang method in
order to match it. i'm still working on a breakout box so i can scope
it out. its alot of work.
for now, it's good to know that if the bx can't do it alone, i'll have
a relatively painless way to fabricate a converter.
in the meantime, i'm checking the atmel docs to see if i can
manipulate the SPI registers in the bx to do what i want.
either way, now i know i can get it done.
mike
>
> Hello Mike,
> This might work for you:
>
> 32-bit serial data buffer IC: RSB509b
> Here is the data sheet: http://www.protean-logic.com/PDFs/Rsb509b2.pdf
>
> The data sheet has connection diagrams as well as sample BS2 code
> (which you can easily convert for your BX chip. In that sample, it
> shows the RSB509B as a receive buffer for the MAX232 to BS2, in your
> case you would reverse this to buffer the 30 bits, then use a signal
> line from your uC to send the data to your device from the buffer.
> The buffer operates at a native 9600bps and is TTL level.
>
> I am not sure what you are trying to send data to... Most devices
> would drop the extra bits after their receive buffers are full, so
> you would only need to shift bits twice (LSL, LSL) on a DWORD value
> then peek the bytes out for transmission...
>
> Hope that helps!
> J
existed. it looks like it would work nicely, although i'll need to
check thier docs to be sure.
at this point i haven't precisely worked out the protocol to talk to
my pda, but i do know that i will have to do the bit bang method in
order to match it. i'm still working on a breakout box so i can scope
it out. its alot of work.
for now, it's good to know that if the bx can't do it alone, i'll have
a relatively painless way to fabricate a converter.
in the meantime, i'm checking the atmel docs to see if i can
manipulate the SPI registers in the bx to do what i want.
either way, now i know i can get it done.
mike
>
> Hello Mike,
> This might work for you:
>
> 32-bit serial data buffer IC: RSB509b
> Here is the data sheet: http://www.protean-logic.com/PDFs/Rsb509b2.pdf
>
> The data sheet has connection diagrams as well as sample BS2 code
> (which you can easily convert for your BX chip. In that sample, it
> shows the RSB509B as a receive buffer for the MAX232 to BS2, in your
> case you would reverse this to buffer the 30 bits, then use a signal
> line from your uC to send the data to your device from the buffer.
> The buffer operates at a native 9600bps and is TTL level.
>
> I am not sure what you are trying to send data to... Most devices
> would drop the extra bits after their receive buffers are full, so
> you would only need to shift bits twice (LSL, LSL) on a DWORD value
> then peek the bytes out for transmission...
>
> Hope that helps!
> J