Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | Re: Queues of a different type

Discussion forum for the BasicX family of microcontroller chips.

Queues of a different type - psyclopedia - Mar 8 20:52:00 2006

Queues are our friend.  They're great for moving data around
efficiently.  Do they only work for byte types?  I can compile an
application using integers in a queue array and I get no errors.  Is
this just an overly permissive compiler?

I'm struggling to write a Kalman filter for ADC values (integers), and
the FIFO queue would work perfectly to keep a running average.  Feed
the values in one end, calculate the average, then read the oldest
value out and read the newest value in.  It sure does eat up a bunch
of RAM.

I just don't know if it actually works though.  I can't test it on
real hardware at the moment.  I'll know for sure tommorow when I can
put a circuit together and see what happens.
	-Don
	


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: Queues of a different type - Tom Becker - Mar 8 21:44:00 2006

 > ... I get no errors.

All types are permissible since the source and destination parameters of 
GetQueue and PutQueue are pointers; that's where the bytewise transfer 
starts, but more than one variable can be moved in one function call.

Working with integers just means you must put to, and get from the queue 
in pairs of bytes.  You are responsible for specifying the byte count, 
in the case of a single integer, 2.

If your filter buffer is 20 samples long, you'll need a queue of 40 
bytes, plus nine bytes of overhead.
	Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Queues of a different type - G. Kramer Herzog - Mar 9 2:15:00 2006

Are sequential bytes possibly transmitted and received without pause?

In other words,if you have SPI, I2C, or One-wire that requires a 16 bit 
word or longer - without pause; is it appropriate to use GetQueue and 
PutQueue?
> 
> All types are permissible since the source and destination parameters 
of
	


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Queues of a different type - Tom Becker - Mar 9 10:53:00 2006

> ... if you have SPI... is it appropriate to use GetQueue and PutQueue?

PutQueue and GetQueue do RAM-to-RAM moves.  In a sense, SPICmd() is 
similar except that it does RAM-to-I/O or vice versa.  Both, however, 
require a starting RAM address and a byte count, so both can transfer 
more than one data item.  Timing and shifting of SPI data is done within 
the SPICmd() function.

I2C and 1-Wire shifting and timing is your responsibility.  Jon Hylands' 
Dallas1Wire.Bas (in the Files section) routines will help, and there are 
several I2C implementations there, too.  None use queues.
	Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )