Hello Rhatidbwoy,
I have a Master board with 20 slaves connected to it. Actually its 20 masters with 1 slave. The 1 board receives data from the various boards to be displayed and printed out on a POS printer. I have a BUSY line that is normally high. When any board has data to send to the display board it takes the busy line to ground for the duration of the transmission. The display board also takes the busy line to ground and holds it there until someone acknowledges the receipt of the alarm message then it releases then busy line so another message can come in. I'm using SERIN2/SEROUT2 on 16F877A's and my display board has an 18F452. The system has been working great. I also have a remote setup that is smaller with 16F872's in the 20 boards and a 16F877A in the display board. It really took a while to get the serial data stuff working reliably but a gentleman by the name of Steven Collins set me in the right direction. I also got some assistance from MElabs.
Main loop monitors several points including:
If BUSY = 0 then GOTO Getdata
Getdata:
PAUSE 5
SERIN2 serpin,36081,300,Main,[Wait ("A"),dec3 B7]
Upon receipt of the 3 character variable B7, the program now goes thru 320 lines of lookup to find a match thengoes to the display and printing routines.
The 300ms wait before going back the Main is because I put a response delay of 10 ms on each card so the each card waits 10ms more than the previous card so the last card (#20) will wait 190ms before sending its data. It's simple but effective!
The project also time stamps the printout, only sounds alarms between 8am and 4:30p Monday thru Friday but always prints. It also prints when the alarm returns to normal. The printer routines use DEBUGOUT.
Hope some of this helps you.
BobK
Bookmarks