Just to be sure, how is it blinking? The possibilities are:
blinking very briefly (about 10% duty cycle) - no servo pulses are being sent and all output channels are low
double-blinking - servo pulses are being sent or an output is high
on for half a second / off for half a second - baud detect mode, waiting for 0xAA
Your connections sound right. How do you power the PIC?
Anyway, you need to either use compact protocol or put the 0xAA back in there. Also, I recommend not doing anything with TRISA at all, and checking whether your software UART library does it for you. You should be able to detect a high voltage on PA1 when the UART is enabled correctly. If you want to see the data getting sent on PA2, put an LED & resistor between that line and 5V - it will blink whenever bytes are sent.
I put the LED inbetween GND and RA1, it lights up a little bit when the PIC isn’t powered. Just got an intermittent 10% duty cycle yellow and a red the error is serial protocol error
The Maestro will drive its TX line high most of the time, but it will not send data on its own without receiving a command. I suggest you check RA2 as I suggested to see whether the PIC is sending data.
How are you powering the PIC?
What code is generating the protocol error? I told you in my last response that your code was obviously wrong, so if you have not changed it, telling me that you are getting a serial protocol error is useless, and if you have changed it, you need to post the new code now if you expect to get help debugging it.
Also, before you never mentioned the red LED, so you must have changed something - what did you change?
I can’t remember what i did when it started doing that. The PIC is running off a seperate 4.8v Rx battery. MAybe i need to go on a forum that specialises in the MikroC program to find it out.
Had a response on the mikroC forum and gonna try that when i get home, just a case of putting 0b infront on the trisa & b values to tell it it is a binary value, otherwise it was thinking it was 3921 (01000000/255)
Your code, as written, will not even compile. It has a missing parenthesis before “46”. What is soft_uart_break() supposed to do? I did not see it in the MikroC manual.
Anyway, until you address the issues I mentioned, there is no chance that it will work: You need to try taking out those TRIS lines so that you do not damage the Maestro or your PIC, then finish switching to the compact protocol, which would start with a 0x84 or 132.
That indicates a brownout detect - the power supply for your Maestro dropped to a value below 4.5 V or so. Have you changed your power supply? Are you still setting TRIS to a value that will short out the Maestro?
Well, I am glad you have it working now. Does it work in auto-baud-detect mode, or just at a fixed baud rate? I am still worried about how you set TRISA before initializing the software UART. I think that this is guaranteed to send a low pulse out on RA1 which could confuse the Maestro in some situations, especially if the start byte follows immediately. I have seen various examples that do not set TRISA at all - maybe you should try that.
Also, I still do recommend the compact protocol for applications using just a single Maestro.
Good luck with your project, and please let us know if you have more questions!
-Paul
Yeah it works in baud detect mode, will try the compact protocol. I am making board for programming via ICSP to stop plugging and unplugging the chip, the legs are getting worn out.