I am working on a project for a set of sensors. The main controller which is a 28x2 talks to a 08m2 through c.4 and c.2. there is another 08m2 connected to c.0 and c.5
I disconnect command is given at the top of the programme. The 28x2 shows its sensor fault detection with the second 08m2 is connected (problem with first 08m2), if its not connected the first 08m2 runs as expected. the second 08m2 runs as expected.
I have not used a switch to switch between the download circuit and the second 08m2 - the download circuit remains connected at all times at the moment
As far as I can tell the first 08m2 is resetting as the command strait after disconnect is to send c.4 high which its not doing while the second 08m2 is connected
I should mention that the second 08m4 pin c.4 (this is also sent high strait after the disconnect command is given) is connected to pin c.5 of the first 08m2. I suspect that when the second 08m2 is sending the first 08m2 into reset or possibly download programme mode despite the disconnect.
The sensors final design should be that they are identical and that a large number of the can be "daisy chained" together (ie commands come into the first one via c.2 and go out to the next sensor via c.0, and back the other way via c.5 and c.0).
here is a snipet of code that the sensor will hopefully run
I am thinking I may have add in a switch of jumper to either download or run as per normal. a DPDT so that both serial in and serial out can be switch at the same time seems like a logical choice for this.
hopefully I have made sense
I disconnect command is given at the top of the programme. The 28x2 shows its sensor fault detection with the second 08m2 is connected (problem with first 08m2), if its not connected the first 08m2 runs as expected. the second 08m2 runs as expected.
I have not used a switch to switch between the download circuit and the second 08m2 - the download circuit remains connected at all times at the moment
As far as I can tell the first 08m2 is resetting as the command strait after disconnect is to send c.4 high which its not doing while the second 08m2 is connected
I should mention that the second 08m4 pin c.4 (this is also sent high strait after the disconnect command is given) is connected to pin c.5 of the first 08m2. I suspect that when the second 08m2 is sending the first 08m2 into reset or possibly download programme mode despite the disconnect.
The sensors final design should be that they are identical and that a large number of the can be "daisy chained" together (ie commands come into the first one via c.2 and go out to the next sensor via c.0, and back the other way via c.5 and c.0).
here is a snipet of code that the sensor will hopefully run
Code:
[color=Blue]symbol laser [/color][color=DarkCyan]= [/color][color=Blue]c.1 [/color][color=Green]'pin to switch laser on or off[/color]
[color=Blue]symbol [/color][color=Purple]sense [/color][color=DarkCyan]= [/color][color=Purple]pinc.3 [/color][color=Green]'input from S6986 sensor
'to next sensor[/color]
[color=Blue]symbol casout [/color][color=DarkCyan]= [/color][color=Blue]c.0 [/color][color=Green]'cascade output[/color]
[color=Blue]symbol [/color][color=Purple]casin [/color][color=DarkCyan]= [/color][color=Purple]pinc.5 [/color][color=Green]'cascade in[/color]
[color=Blue]symbol cascserial [/color][color=DarkCyan]= [/color][color=Blue]c.5[/color]
[color=Green]'to previous sensor or controller[/color]
[color=Blue]symbol prevout [/color][color=DarkCyan]= [/color][color=Blue]c.4
symbol [/color][color=Purple]previn [/color][color=DarkCyan]= [/color][color=Purple]pinc.2[/color]
[color=Blue]symbol prevserial [/color][color=DarkCyan]= [/color][color=Blue]c.2
symbol baud [/color][color=DarkCyan]= [/color][color=Blue]n2400_16
symbol [/color][color=Purple]flag [/color][color=DarkCyan]= [/color][color=Purple]b0 [/color][color=Green]'flag variable[/color]
[color=Blue]symbol [/color][color=Purple]address [/color][color=DarkCyan]= [/color][color=Purple]b1 [/color][color=Green]'address variable[/color]
[color=Blue]symbol [/color][color=Purple]instruct [/color][color=DarkCyan]= [/color][color=Purple]b2 [/color][color=Green]'instruction variable[/color]
[color=Blue]symbol [/color][color=Purple]number [/color][color=DarkCyan]= [/color][color=Purple]b3 [/color][color=Green]'number of sensors (address + 1)[/color]
[color=Blue]symbol [/color][color=Purple]escflag [/color][color=DarkCyan]= [/color][color=Purple]b4[/color]
[color=Blue]symbol [/color][color=Purple]mode [/color][color=DarkCyan]= [/color][color=Purple]b5[/color]
[color=Blue]symbol [/color][color=Purple]loopnumber [/color][color=DarkCyan]= [/color][color=Purple]w3[/color]
[color=Blue]symbol qual [/color][color=DarkCyan]= [/color][color=Red]"U" [/color][color=Green]'qualifier varaible[/color]
[color=Blue]symbol type [/color][color=DarkCyan]= [/color][color=Red]"L" [/color][color=Green]'sensor type[/color]
[color=Blue]symbol test [/color][color=DarkCyan]= [/color][color=Red]"A" [/color][color=Green]'recieved from controller[/color]
[color=Blue]symbol send_test [/color][color=DarkCyan]= [/color][color=Red]"B"[/color]
[color=Blue]let [/color][color=Purple]dirsc [/color][color=DarkCyan]= [/color][color=Navy]%00010011[/color]
[color=Blue]disconnect[/color]
[color=Black]init:
[/color][color=Green]'this does no execute on first 08m2 if second 08m2 is connected
[/color][color=Blue]high prevout [/color][color=Green]'send here signal to previous
[/color][color=Blue]let [/color][color=Purple]loopnumber [/color][color=DarkCyan]= [/color][color=Navy]0
[/color][color=Blue]pause [/color][color=Navy]250
[/color][color=Blue]high casout [/color][color=Green]'send signal to next sensor
[/color][color=Blue]do while [/color][color=Purple]previn [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Green]'wait to recieve 'heard' signal from previous
[/color][color=Blue]inc [/color][color=Purple]loopnumber [/color][color=Green]'or wait for period of time before leaving
[/color][color=Blue]if [/color][color=Purple]loopnumber [/color][color=DarkCyan]= [/color][color=Navy]20000 [/color][color=Blue]then exit
loop
low prevout [/color][color=Green]'stop sending here signal when heard signal recieved
[/color][color=Blue]if [/color][color=Purple]casin [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then
let [/color][color=Purple]escflag [/color][color=DarkCyan]= [/color][color=Navy]1
[/color][color=Blue]end if
pause [/color][color=Navy]1000 [/color][color=Green]'weigth for previous to listen for sensot type
[/color][color=Blue]if [/color][color=Purple]loopnumber [/color][color=DarkCyan]> [/color][color=Navy]19000 [/color][color=Blue]then [/color][color=Black]dumb_sensor[/color]
hopefully I have made sense