Hello all,
I'm hoping for some assistance in solving a problem that I suspect has become my not being able to see the wood for the trees. The example attached is the simplest that I have been able to reduce the problem to, while still keeping the functionality I need and the problem visible.
The purpose of the exercise is to arbitrate a bus to determine which of M PICAXEs is permitted to transmit over a serial bus. I have only one wire available, so the idea is that any chip wanting to transmit must first activate this signal with a pulse (a so-called primer pulse) that is unique in length to itself. All chips measure the length of the pulse. I needn't go any further with the description because not even this first bit is working!
Please load and run the attachments. U1 is the transmitter and U2 the receiver. U3 is used purely to trigger U1, which correctly pulls the arbitration signal, FRED_ENG, active and then enters state FSM_StopPrimer. U2 responds to the change in FRED_ENG and enters state FSM_MeasPrimer. So far, so good. At the end of the primer pulse, U1 releases FRED_ENG and enters state FSM_Relax, which is also correct and, in fact, U1 will continue to behave correctly. The problem, however, is with U2, which does not respond to FRED_ENG being released at the end of the primer pulse. This I do not understand at all. The B.7 ports are hard wired together, the pull ups are activated (there are external pull ups anyway), the interrupts on both U1 and U2 are set up identically (SETINT 0x80, 0x80, B), and the signal at B.7 goes to logic 1 for more than 10 ms, surely an aeon in terms of triggering an interrupt. U1 does respond, but U2, apparently set up identically, doesn't. Can anyone see why?
I've tried applying a pulse from an external source directly to FRED_ENG and this does trigger the interrupt.
I'm fairly new to PICAXEs and am still groping around a bit when it comes to coding. If anyone has any constructive comments on how I might do things better then they'd be much appreciated.
Roger.
View attachment InterruptTest.DSN
View attachment InterruptTest28X2.bas
I'm hoping for some assistance in solving a problem that I suspect has become my not being able to see the wood for the trees. The example attached is the simplest that I have been able to reduce the problem to, while still keeping the functionality I need and the problem visible.
The purpose of the exercise is to arbitrate a bus to determine which of M PICAXEs is permitted to transmit over a serial bus. I have only one wire available, so the idea is that any chip wanting to transmit must first activate this signal with a pulse (a so-called primer pulse) that is unique in length to itself. All chips measure the length of the pulse. I needn't go any further with the description because not even this first bit is working!
Please load and run the attachments. U1 is the transmitter and U2 the receiver. U3 is used purely to trigger U1, which correctly pulls the arbitration signal, FRED_ENG, active and then enters state FSM_StopPrimer. U2 responds to the change in FRED_ENG and enters state FSM_MeasPrimer. So far, so good. At the end of the primer pulse, U1 releases FRED_ENG and enters state FSM_Relax, which is also correct and, in fact, U1 will continue to behave correctly. The problem, however, is with U2, which does not respond to FRED_ENG being released at the end of the primer pulse. This I do not understand at all. The B.7 ports are hard wired together, the pull ups are activated (there are external pull ups anyway), the interrupts on both U1 and U2 are set up identically (SETINT 0x80, 0x80, B), and the signal at B.7 goes to logic 1 for more than 10 ms, surely an aeon in terms of triggering an interrupt. U1 does respond, but U2, apparently set up identically, doesn't. Can anyone see why?
I've tried applying a pulse from an external source directly to FRED_ENG and this does trigger the interrupt.
I'm fairly new to PICAXEs and am still groping around a bit when it comes to coding. If anyone has any constructive comments on how I might do things better then they'd be much appreciated.
Roger.
View attachment InterruptTest.DSN
View attachment InterruptTest28X2.bas