A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
address decode on serial - Randy McKenzie - Nov 28 9:37:32 2007
Hello all:
I have a desire for a project to use a PC as a master, poll various
pics on a rs485 network, using a very simple polling idea and have
the pics respond with their status as well as take data from the pic
if desired.
Im working on this in small parts and my first thoughts on overall
programming is this to get the pic to respond to its address:
pic watches the data stream for a "sync byte" such as "89"
if "89" appears then check the next byte for its address such as "02"
if "02" is its address then respond with its status
I tried this before without using the sync byte and the pic
responded to any bit sequence that appeared and matched 4 bits. By
using the sync byte, will this help with the false responses? my
first attempt was using a addres of "2" and any bit opattern that
matched "0010" falsed a response.
Serial speed is not set, I tested at 9600.....
PIC is 16F627/16F628
Im a NOVICE to programming and trying to learn as I go here.
All help appreciated!
Randy
kk4ej
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: address decode on serial - Dennis Clark - Nov 28 14:13:04 2007
You don't need to do that with the newer PICs. Read up on "9th bit
addressing" for the PIC. In this mode the 9th bit is set and the USART
recognizes this as an address. Your code then needs only to look for this
bit set to pay attention to a byte as an address.
DLC
> Hello all:
>
> I have a desire for a project to use a PC as a master, poll various
> pics on a rs485 network, using a very simple polling idea and have
> the pics respond with their status as well as take data from the pic
> if desired.
>
> Im working on this in small parts and my first thoughts on overall
> programming is this to get the pic to respond to its address:
>
> pic watches the data stream for a "sync byte" such as "89"
> if "89" appears then check the next byte for its address such as "02"
> if "02" is its address then respond with its status
>
> I tried this before without using the sync byte and the pic
> responded to any bit sequence that appeared and matched 4 bits. By
> using the sync byte, will this help with the false responses? my
> first attempt was using a addres of "2" and any bit opattern that
> matched "0010" falsed a response.
>
> Serial speed is not set, I tested at 9600.....
> PIC is 16F627/16F628
>
> Im a NOVICE to programming and trying to learn as I go here.
>
> All help appreciated!
>
> Randy
> kk4ej
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
>

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Re: address decode on serial - Dennis Clark - Dec 13 16:06:29 2007
You can't get a PC to generate it. PC UARTS aren't capable of it. You
need to get a RS485 module between the network and the PC to handle that
part of the protocol. With enough effort you might get the PC to do some
kind of parity bit fiddling to get it to work, but an interface dongle is
a bit simpler to manage I think.
DLC
> I read about the 9th bit address.....
>
> How do I get the pc to generate it? Im using QBASIC on the pc and
> not sure how to create a extra bit there.
>
> Randy
>
> -- In p...@yahoogroups.com, "Dennis Clark"
wrote:
>>
>> You don't need to do that with the newer PICs. Read up on "9th bit
>> addressing" for the PIC. In this mode the 9th bit is set and the
> USART
>> recognizes this as an address. Your code then needs only to look
> for this
>> bit set to pay attention to a byte as an address.
>>
>> DLC
>>
>> > Hello all:
>> >
>> > I have a desire for a project to use a PC as a master, poll
> various
>> > pics on a rs485 network, using a very simple polling idea and
> have
>> > the pics respond with their status as well as take data from the
> pic
>> > if desired.
>> >
>> > Im working on this in small parts and my first thoughts on
> overall
>> > programming is this to get the pic to respond to its address:
>> >
>> > pic watches the data stream for a "sync byte" such as "89"
>> > if "89" appears then check the next byte for its address such
> as "02"
>> > if "02" is its address then respond with its status
>> >
>> > I tried this before without using the sync byte and the pic
>> > responded to any bit sequence that appeared and matched 4 bits.
> By
>> > using the sync byte, will this help with the false responses? my
>> > first attempt was using a addres of "2" and any bit opattern that
>> > matched "0010" falsed a response.
>> >
>> > Serial speed is not set, I tested at 9600.....
>> > PIC is 16F627/16F628
>> >
>> > Im a NOVICE to programming and trying to learn as I go here.
>> >
>> > All help appreciated!
>> >
>> > Randy
>> > kk4ej
>> >
>> >
>> >
>> >
>> > to unsubscribe, go to http://www.yahoogroups.com and follow the
>> > instructions
>> >

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )Re: address decode on serial - Randy McKenzie - Dec 15 3:11:11 2007
I read about the 9th bit address.....
How do I get the pc to generate it? Im using QBASIC on the pc and
not sure how to create a extra bit there.
Randy
-- In p...@yahoogroups.com, "Dennis Clark"
wrote:
>
> You don't need to do that with the newer PICs. Read up on "9th bit
> addressing" for the PIC. In this mode the 9th bit is set and the
USART
> recognizes this as an address. Your code then needs only to look
for this
> bit set to pay attention to a byte as an address.
>
> DLC
>
> > Hello all:
> >
> > I have a desire for a project to use a PC as a master, poll
various
> > pics on a rs485 network, using a very simple polling idea and
have
> > the pics respond with their status as well as take data from the
pic
> > if desired.
> >
> > Im working on this in small parts and my first thoughts on
overall
> > programming is this to get the pic to respond to its address:
> >
> > pic watches the data stream for a "sync byte" such as "89"
> > if "89" appears then check the next byte for its address such
as "02"
> > if "02" is its address then respond with its status
> >
> > I tried this before without using the sync byte and the pic
> > responded to any bit sequence that appeared and matched 4 bits.
By
> > using the sync byte, will this help with the false responses? my
> > first attempt was using a addres of "2" and any bit opattern that
> > matched "0010" falsed a response.
> >
> > Serial speed is not set, I tested at 9600.....
> > PIC is 16F627/16F628
> >
> > Im a NOVICE to programming and trying to learn as I go here.
> >
> > All help appreciated!
> >
> > Randy
> > kk4ej
> >
> >
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
> > instructions
> >

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