
Aaron P (Customer) asked a question.
For a while I could upload programs just fine but all of a sudden My computer cannot detect when my PLC is connected. I have tried using different computers but that does not work. If there is no external power source the LED on the P1AM-100 does come on when plugged in so I know it has power. The only thing that somewhat helps so far is resetting the PLC, unplugging it and plugging it back in again. This at least makes it that the com is visible but it does not always show as a P1AM-100. The only program I was able to upload when I tried this a few times was an example program that turns the LED on or off dependent on the lever on the front of the PLC.
I may have replicated your issue but you would have to know what the previous code was and if it was the cause. If you do I would replicate the issue and then adjust the code to fix it for confirmation.
Going by the code you posted above, I can replicate the issue from the symptoms you described by uncommenting the line:
You have to first call P1.init() before using any of the library function calls to the module's like readDiscrete, writeDiscrete, ect.
We do have channel labels that you could use to make the your code look cleaner.
There's an example under P1AM -> Basic -> ChannelLabels. Below is a use case.