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 CCS Technical Support

TX/RX simple 1 wire custom made protocol...?

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



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

TX/RX simple 1 wire custom made protocol...?
PostPosted: Fri Aug 15, 2014 2:30 pm     Reply with quote

I need to transmit and receive some data on a 1 wire simple custom made protocol.

There are two unit, one is sending and one is receiving! Not two way com.

Communication must be slow and real simple. First I think using slow RS232 maybe 1200b. The code must be simple C, use of delay is optimal here.

We are talking simple protocol, no checking and complicated stuff, just some clean and simple ansi C stuff. It is not time critical.

Maybe someone have some working code?:-)
temtronic



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

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 2:39 pm     Reply with quote

CCS supplies an example in the FAQ section(?) using a 'one wire' configuration, though good old 'RS-232' will work fine if half duplex using putc(), getc().
you may need 'drivers' on the wire if going more than say 1M.
hth
jay
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 3:02 pm     Reply with quote

Hi

NO wire it is light from a monitor, sound old and crazy. Only ansi C
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Fri Aug 15, 2014 4:26 pm     Reply with quote

I "made" this:

http://www.ccsinfo.com/forum/viewtopic.php?t=51489

months later i don't think it solves any issues but it was fun to make.


I think what you are trying to do is blink a couple of pixels on the screen black and white and use it to program/configure somthing...


Check out hackaday.com... ive seen this before.. cant tell you where in the site.

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Sat Aug 16, 2014 12:28 am     Reply with quote

Yes just that, light is a real cheap way to update some user config on a system. OK, i will make something my self...
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Sat Aug 16, 2014 2:48 am     Reply with quote

It's worth just adding, that the existing 'software' RS232, now supports (has done for a few years now), 'FLOAT_HIGH' as an option. When this is used, the driver _only_ pulls the line low, just like I2C drive.

So you can simply have two #use RS232 statements, one just defining a TX pin, and one defining an RX pin, like:

Code:

#use RS232 (BAUD=1200, TX=PIN_A0, FLOAT_HIGH, STREAM=TXO)
#use RS232 (BAUD=1200, RX=PIN_A0, STREAM=RXI)

Then simply have a pull-up resistor on this line, and you can fputc to the stream TXO, and the data will be sent on the line, and fgetc on RXI to receive.

If you use a pin that supports an interrupt on falling edge, then both devices can ignore the line, till it drops to say the other device is signalling.

The only 'ingenuity', is working out how to handle things like simultaneous 'starts' occurring.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sat Aug 16, 2014 8:03 am     Reply with quote

Ttelmah wrote:
The only 'ingenuity', is working out how to handle things like simultaneous 'starts' occurring.


CAN deals with this by having a fresh start after a random delay.
It does have to monitor for bus contention.

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Sat Aug 16, 2014 8:52 am     Reply with quote

Yes.
The key thing is though that using 'one wire' open collector drive, with software RS232, you won't know it's happened. Remember that software RS232 doesn't read the line at the same time as writing, so won't even know that something else has pulled the line low.
So long as this approach is 'single master', it is no problem, but trying for anything like multi-master, will be quite difficult.
For single master, with reply only, this approach needs the minimum software. Smile
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Tue Aug 19, 2014 4:09 am     Reply with quote

Hi

My solution after some test.

C# program there read some configurations string and flash them out on a monitor. I made lot of test with ambiance-light sensors. The best result was some gray level on the monitor. I convert the string to bit resulting in gray, white, and black. It wont work with just black and white and some timing. Therefore the 3 gray level, it eliminate the timing issue. So simple to convert to .ASP and mobil phone.

For reading the blink stream I use my PIC and one ad-converter there slice the light level into to bit again. It work, and it is cheap fast and smart!
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