pictik
Newbie level 4
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
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