Bit banging RF remote

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Marco
Posts: 1
Joined: Sat Jan 26, 2008 8:41 pm

Bit banging RF remote

Post by Marco »

I am a starting user of Flowcode. So maybe my question is not as hard to answer but it is for me.
My goal is to simulate a train of bits like they are produces by a RF remote controll.

I have read a lot and I think I have to bit bang these pulses but maybe there is a better solution. I have to transmit 128 bits at a speed of 1500bit/s

Does anyone have a good example in Flowcode or C code I can use in FLowcode?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Bit banging RF remote

Post by Benj »

Hello

Get a PICmicro with a UART and use the RS232 component. Much easier.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times

Re: Bit banging RF remote

Post by Sean »

You can use a Flowcode C Code block to gain access to the C function 'delay_10us()'.

delay_10us(67); will give you a 1500bit/s delay with approximately 0.5% accuracy. A 16-byte array (declared as a Flowcode string) can by used to store the 128-bits of data.

The delay function can be used to control the cycle time of a While() loop.

You can use counter variables within the loop to locate the bit required for transmission in the data array on each cycle of the loop.

The data in individual bytes can be shifted using the << (shift left) or >> (shift right) operator:

data[0] = data[0] << 1 will shift the contents of data[0] one place to the left

Individual bits can be read from a byte using the AND operator.

Example:
tx_val = data[0] AND 64 will copy bit 6 of data[0] to tx_val.
Note: The result of this operation would be 0 or 64, the bit value should be be treated as zero = 0, non-zero = 1

Greater timing accuracy would probably require the use of hardware timers and interrupts.

Post Reply