CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Questions on implementing TDMA

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
raptorman



Joined: 08 Mar 2008
Posts: 12

View user's profile Send private message

Questions on implementing TDMA
PostPosted: Sat Aug 10, 2013 2:24 pm     Reply with quote

I'm trying to implement some sensors on SBUS2 for my RC hobby. I program for a living but only in iOS and Visual Studio. I dont expect any code, just some suggestions on implementing the design. I'm using a 18lf14k22 and CCS compiler 5.011. I'm also including an image that shows the overall data stream.

I have a 100k Serial Stream with 4 sections of main data consisting of 25 bytes each with a ending byte that identifies which main section of data. In between each main section, you have 8 slots of sensor data consisting of 3 bytes for each slot. I'm creating my own sensors and putting the data into 1 of 32 unused slots. I'm receiving the main and slot data thru the uart.

So the question on design is how to sync up with the main data so I know where I'm at. This is what I was thinking:

Sync up with the data:
Wait for the serial to go high using an interrupt-on change.
Start timer.
wait for it to go low using an interrupt-on change.
if timer less than 5ms(time from last slot to main data), repeat the above.
If timer over 5ms its should be starting the next main section of data.
I have the last main section of data, its ending byte from the uart.
Look at the previous ending byte and I know where I'm at.

Once the program knows where it at, I can calculate when to put data out into the slots. That brings up the next design phase of precise timing the output of the data using the uart or bit-banging.

Anybody else have a better solution?

Thanks,

Jerry

Couldnt get image to display so click URL:
http://rc.runryder.com/helicopter/rr/rrpv.htm?d=/helicopter/gallery/32504/&IN=1&TZ=-7&a=0&s=0
temtronic



Joined: 01 Jul 2010
Posts: 9203
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Aug 11, 2013 6:21 pm     Reply with quote

I didn't 'google ' too long but...
There seems to be a lot of 'activity' with Ardunios and SBUS2, so you
could port their C code into CCS C code.

You've probably already hit the net..but providing you've got working hardware, the code conversion should be fairly straightforward, and can be easily tested on the bench.

hth
jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group