Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

protocol design in assembler

Status
Not open for further replies.

pictik

Newbie level 4
Joined
May 6, 2010
Messages
6
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Canada
Activity points
1,334
Hi all,

I am designing a rs485 2 wire multi-drop network, this is for a learning/hobby project, I am having trouble creating the code in assembler, I am not up to speed in C and would like to try to stay away from basic as im still fairly new to pic controllers and want to learn assembler.

Right now I can pass data only one way to one pic from my PC, others just dont listen, I know its in my very bad code as its basicaly just the reference code copied in.

Any help would be appericated.


My protocol wishes: using 16f877(a) and a max-485 4MHz xtal master to be a PC
9600,8n1 buss config
address up tp 254 slaves adrress 0x00 is master 0xFF is a broadcast possibly addressing up to 65535 adresses by using second address byte
master to poll in rapid order, slaves to respond in under 100ms
paket to look like: start,address,command,register,data,data,stop
max paket length i have set to 25 registers to prevent erronious register lockups
256 possible commands (only 6 defined as of yet)
0x00 read register, single
0x10 write register, single
0x05 read register then advance one register address and read untill register = fisrt data
0x25 write register and advance register address and write until stop byte,
0x30 write all user registers with 0x00
0xFF saftey stop, forces all addressed MCUs to read their saftey stop subroutine and inform master they are in safe stop mode. all outputs relays are open (i never use nc power circuits), indictor led lit red and may be flashing
 

thanks for the 101 in rs232, but my question was based on protocols not the physical layer, i chose rs485 for that and can send bytes fine, just dont know how to implement a protocol for control. part of the protocol is addressing, how to make pic respond to thier address and reply.
PS i am self taught in programming, i have never taken programming course so i am missing concepts that may seem elementry to most professionals.
 

Case closed,

I found help else-where and now have a workable protocol for multi pic networks based off a master slave polling system.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top