Discussion forum for the BasicX family of microcontroller chips.
|
I haven't tested this, but the approach is right. DacAddress is an integer with the two bit port address. DacVoltage is the 8 bit output voltage. Built up an integer with the DAC output port and the 8 bit value. Let DataPin be the pin number you are using for SDA. Let ClockPin be the pin number you are using for SCL. Let LoadPin be the pin number you are using for LOAD/. Let LoadDac be the pin number you are using for LDAC/. Dim i as Integer Dim DacOutput as Integer DacOutput = DacAddress * 256 + DacVoltage For i = 10 to 1 step -1 Call PutPin(DataPin, GetBit(DacOutput, i - 1) ) 'generate the clock pulse Call PulseOut(ClockPin, 1, 0) Next Now you can LOAD/ it: Call PulseOut(LoadPin,1,0) Repeat for the other output voltages, if any. Then: Call PulseOut(LoadDac,1,0) Andy -----Original Message----- From: [mailto:] Sent: Wednesday, October 25, 2000 6:12 AM To: Subject: [BasicX] getbit command hi, i need to use basicX to send 10bits data to a DAC(MAX500) but from the document i have, it only show how to get single byte of data which is 8 bits. can someone help me to write the program of it??? i only managed to send 8 bits to the DAC. thanxs a lot |
|
|
|
hi, thanxs a lot for your help these few days. but there is some problem at the for loop there. u initialise the i as integer but the getbit command need byte instead of integer. i tried many times but still can't get the output result frm it. would u kindly help me to solve this problem?? thanxs a lot -----Original Message----- From: "Michalicek, Andrew (AZ76)" <> Date: Wed, 25 Oct 2000 07:58:14 -0700 To: "'BasicX Email Group'" <> Subject: FW: [BasicX] getbit command > > I haven't tested this, but the approach is right. > > DacAddress is an integer with the two bit port address. > DacVoltage is the 8 bit output voltage. > > Built up an integer with the DAC output port and the 8 > bit value. Let DataPin be the pin number you are using > for SDA. Let ClockPin be the pin number you are using for > SCL. Let LoadPin be the pin number you are using for LOAD/. > Let LoadDac be the pin number you are using for LDAC/. > > Dim i as Integer > Dim DacOutput as Integer > > DacOutput = DacAddress * 256 + DacVoltage > > For i = 10 to 1 step -1 > Call PutPin(DataPin, GetBit(DacOutput, i - 1) ) > 'generate the clock pulse > Call PulseOut(ClockPin, 1, 0) > Next > > Now you can LOAD/ it: > > Call PulseOut(LoadPin,1,0) > > Repeat for the other output voltages, if any. Then: > > Call PulseOut(LoadDac,1,0) > > Andy > -----Original Message----- > From: [mailto:] > Sent: Wednesday, October 25, 2000 6:12 AM > To: > Subject: [BasicX] getbit command > hi, > > i need to use basicX to send 10bits data to a DAC(MAX500) but from > the document i have, it only show how to get single byte of data > which is 8 bits. > > can someone help me to write the program of it??? > > i only managed to send 8 bits to the DAC. > > thanxs a lot > -- |
|
Joey, I finally got around to checking out SHIFTOUT. This is what you need to talk the the DAC. In this example, I have used: pin 11 as the data line, pin 12 as the clock line, pin 10 as the strobe line LoadReg/ pin 9 as the strobe line LoadDAC/ ShiftOut sends out the most significant bit first (bit 7) and the least significant bit last (bit 0). (Jack, the documentation needs to include this info.) You will be using the ShiftOut command twice, first for the DAC address, and then for the 8 bit value. This is necessary because the ShiftOut command can send a max of 8 bits. When you send out the DAC address, it must be placed in the two most significant bits. Thus, DAC0 is 0, DAC1 is &H40, DAC2 is &H80, and DAC3 is &HC0. 'Create variables to hold the DAC values for DAC0 and DAC1 Dim DACValue0 as Byte Dim DACValue1 as Byte 'initialize the clock, LoadDAC, and LoadReg to a high state. 'The clock line must be initialized high to have a rising edge 'clock the data in. call putpin(9,1) call putpin(10,1) call putpin(12,1) Now, when you are ready to output the values... ' First DAC call shiftout(11,12,2,&h00) 'DAC0 2 bit address out call shiftout(11,12,8,DACValue0) 'DAC0 8 bit data out call pulseout(10,1,0) 'now LoadReg ' Second DAC call shiftout(11,12,2,&h40) 'DAC1 2 bit address out call shiftout(11,12,8,&hf5) 'DAC1 8 bit data out call pulseout(10,1,0) 'now LoadReg call pulseout(9,1,0) 'now LoadDAC I looked at the timing. The DAC should be pretty forgiving, but your system may not. The clock period is 3.8 usec per bit, for just over 250 KHz, so that it can be used with I2C. From the start of the address shiftout to the start of the data shiftout is 94 usec. The second DAC starts 283 usec after the start of the first. The total time from start to the LoadDAC pulse is 550 usec. Andy > -----Original Message----- > From: babykitty00@a... [mailto:babykitty00@a...] > Sent: Wednesday, October 25, 2000 6:12 AM > To: > Subject: [BasicX] getbit command > hi, > > i need to use basicX to send 10bits data to a DAC(MAX500) but from > the document i have, it only show how to get single byte of data > which is 8 bits. > > can someone help me to write the program of it??? > > i only managed to send 8 bits to the DAC. > > thanxs a lot |
|
I have been experimenting with using a BX-24 in a wireless communication link. There is no specific application at this time, it is purely a matter of learning how to use RF devices. The transmitters and receivers I am using only support On-Off-Keying communications protocols. I have written a simple protocol that works, (the TX side sends consecutive numbers from 1 to 250; the RX side compares received values with anticipated values, logs errors and total events, but it is not particularly robust. It has no error checking and has no error correction capabilities. Based on an Internet search, it appears that I can significantly improve the protocol by implementing a Manchester encoding approach, error detection via a checksum or CRC, and error correction by using redundant data transmission. Before going down that path, I would appreciate receiving feedback from those on this list who may have experience in this area. Recommendations for a reference on RF protocols suitable for use with OOK devices would be appreciated. Sample code would be helpful, but I do not want push my luck. TIA Dan |
|
|
|
I'm familiar with how X-10 handles RF. They use the original NEC IR protocol but with an RF carrier. I've just put up a page that explains it. See... http://www.geocities.com/Dorothy1801/rf.htm They're only sending two bytes of payload data with each transmission. Anything other than intermittent control codes requires an FCC license. On 5 Apr 2001, at 9:03, Dan T. Barber wrote: > I have been experimenting with using a BX-24 in a wireless > communication link. There is no specific application at this time, it > is purely a matter of learning how to use RF devices. The transmitters > and receivers I am using only support On-Off-Keying communications > protocols. I have written a simple protocol that works, (the TX side > sends consecutive numbers from 1 to 250; the RX side compares received > values with anticipated values, logs errors and total events, but it > is not particularly robust. It has no error checking and has no error > correction capabilities. Based on an Internet search, it appears that > I can significantly improve the protocol by implementing a Manchester > encoding approach, error detection via a checksum or CRC, and error > correction by using redundant data transmission. Before going down > that path, I would appreciate receiving feedback from those on this > list who may have experience in this area. Recommendations for a > reference on RF protocols suitable for use with OOK devices would be > appreciated. Sample code would be helpful, but I do not want push my > luck. > > TIA > > Dan > ------------------------ Yahoo! Groups Sponsor > ---------------------~-~> Get great low international calling rates > from Net2Phone! Click Here! > http://us.click.yahoo.com/pOl7zD/kJXCAA/4ihDAA/CYAVlB/TM > ---------------------------------------------------------------------_ > - > > --- The BX24-AHT All Housecode Transceiver is at: http://www.geocities.com/dorothy1801/ |
|
|
|
Dave, Thanks for the assistance! You have put together a very informative web site. I've downloaded much of the information you have posted and will begin working through it tonight. Dan -----Original Message----- From: Dave Houston [mailto:] Sent: Thursday, April 05, 2001 9:24 AM To: Subject: Re: [BasicX] Request for Recommendation on RF Encoding I'm familiar with how X-10 handles RF. They use the original NEC IR protocol but with an RF carrier. I've just put up a page that explains it. See... http://www.geocities.com/Dorothy1801/rf.htm They're only sending two bytes of payload data with each transmission. Anything other than intermittent control codes requires an FCC license. On 5 Apr 2001, at 9:03, Dan T. Barber wrote: > I have been experimenting with using a BX-24 in a wireless > communication link. There is no specific application at this time, it > is purely a matter of learning how to use RF devices. The transmitters > and receivers I am using only support On-Off-Keying communications > protocols. I have written a simple protocol that works, (the TX side > sends consecutive numbers from 1 to 250; the RX side compares received > values with anticipated values, logs errors and total events, but it > is not particularly robust. It has no error checking and has no error > correction capabilities. Based on an Internet search, it appears that > I can significantly improve the protocol by implementing a Manchester > encoding approach, error detection via a checksum or CRC, and error > correction by using redundant data transmission. Before going down > that path, I would appreciate receiving feedback from those on this > list who may have experience in this area. Recommendations for a > reference on RF protocols suitable for use with OOK devices would be > appreciated. Sample code would be helpful, but I do not want push my > luck. > > TIA > > Dan > ------------------------ Yahoo! Groups Sponsor > ---------------------~-~> Get great low international calling rates > from Net2Phone! Click Here! > http://us.click.yahoo.com/pOl7zD/kJXCAA/4ihDAA/CYAVlB/TM > ---------------------------------------------------------------------_ > - --- The BX24-AHT All Housecode Transceiver is at: http://www.geocities.com/dorothy1801/ Yahoo! Groups Sponsor Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. [Non-text portions of this message have been removed] |