PicAxe to PicAxe communication via PWM/ADC

bcj

New Member
Just floating a wild thought here.

Have been looking at an application where I needed to pass data between chips and had limited inputs in the second chip but want to be able to pass a number of different 'states' or 'commands' to the second chip.

Had the brainstorm that if one varied a pwmout value then that could be read and acted upon by the receiving chip with a ReadADC.
This potentially allows the passing of up to 256 different 'states' or 'commands' to the second chip. The advantage is that this would be;
1. simple
2. be completely asynchronous
3. would not incur any delays in processing.
Naturally this would only be useful in certain types of communication. In the application being considered three different states of the same condition needed to be passed to the second chip which would take differnet actions depending on the state passed. These 'states' arise from logic decions in the the first chip program - not directly from external inputs. There was only one input available on the second chip without moving to a bigger chip with more inputs available (which is what I am doing currently).

I am not sure if a pwmout would be seen by the second chip's ADC input as a steady voltage but if not, presumably a simple Capacitor in the link would smooth this sufficiently and a current limiting resistor would be required to prevent an overcurrent when charging the capacitor.

Any thoughts?

 
 

Tom2000

Senior Member
Cool idea!

Using high PWM frequencies, filtration should be a simple task. A simple RC circuit, as you've indicated, with very short time constatnts for quick response would be just the ticket.

Although it probably wouldn't work for 256 states, it would most likely be reliable for 16 or 32. And your method sure provides all the advantages you mentioned.

It's a great new tool to stick in our Picaxe toolkits.

Thanks!

Tom


Edited by - Tom2000 on 13/07/2007 14:30:30
 

Michael 2727

Senior Member
You can make the PWM accurately 0% to 100% but the READADC may wander slightly.
Increments of 5 ADC units may work better.
Pulsin may work a little better, you won't need to buffer the PWM then,(RC network ).

PS: If you try Pulsin you may need to prescale the PWM to 250Hz <A href='http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=6424&amp;forum_id=30&amp;Topic_Title=A%2B%2BPICAXE%2BPowered%2BElectric%2BScooter&amp;forum_title=No+new+posts+please%21+22' Target=_Blank>External Web Link</a>.
Or don't use the lower 25% as pulsin starts to bottom out at around 12KHz from memory @ 4MHz clock speed.

Edited by - Michael 2727 on 13/07/2007 14:55:32
 

BeanieBots

Moderator
Indeed, this is an old trick used by PICAXErs.
Not been covered for a while so good to bring it up again.

Rather than filter and use ADC, you get better results using pulsin.
It's not reliable trying to get the full PWM resolution but 7-bit or lower is quite possible. Remeber to add 1 to the sender or there is no PWM signal<img src="wink.gif" width=15 height=15 align=middle>.
You can also set up many low-res channels using the servo command.
Not tried it with two resonator driven chips but that should yeald 9-bit resolution using PWMout.
 

Tom2000

Senior Member
<i>&quot;Indeed, this is an old trick used by PICAXErs.&quot; </i>

Well, you can sure tell who the newbies are around here, can't you? :)

Newbie
 

BeanieBots

Moderator
Had a quick search and found the earliest reference dating back to Oct 2004.
<A href='http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=1888&amp;forum_id=13&amp;Topic_Title=picaxe%2Bto%2Bpicaxe%2Bcomms&amp;forum_title=No+new+posts+please%21+7' Target=_Blank>External Web Link</a>
The archives are absolute goldmine of information. Shame people don't bother with the search and bigger shame that the search is not very good.

Edited by - beaniebots on 13/07/2007 17:28:52
 

Tom2000

Senior Member
But the upside is that, of all the unrelated information your search returns, you invariably find something far more interesting than what you originally started out to find. :)

Tom
 

bcj

New Member
Thanks for the feed back all. As has been said before - &quot;There is nothing new under the sun&quot;

Looks like pwmout prescaled and pulsin is the way to go.


 
 
Top