IIRC, Mikrobasic has 8 bit signed & unsigned short integers as well as longs. Unsigned should work.
IIRC, Mikrobasic has 8 bit signed & unsigned short integers as well as longs. Unsigned should work.
I've had a couple people on here tell me I should write an article about my project and I will once I get some of the major issues worked out and I will include pictures and I'll be sure to put a link on here to it.
I switched the type to byte but it just seems like they aren't syncing properly. In picbasic does the SERIN2 expect a start and stop bit after every 8 bits or does it expect a start bit then the 48 data bits and then a stop bit? Because MIKROBASIC sends a byte at a time so it sends start and stop bits after every bit.
Oops I meant after every byte in the last sentence.
All packets will include a start bit, 8 data bits, and the stop bit. You might have better luck if you increase (or get rid of) the timeout period.
Prolly just adding noise here, But how does the "sender" know the "receiver" is ready and able to receive?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
If mikrobasic allows, you might try increasing the time between bytes.
Ok we made some progress. I added a 500us pause between bytes and its getting the values now.
But now only the first chip is getting the serial. The 3 slave chips are on seperate lines. The first chip is getting values but the second 2 aren't getting any. My transmit code is below
Code:sub procedure Send() porta.0 = 1 portc.2 = 1 error1 = Soft_UART_Init(PORTC,1, 5, 9600, 0) delay_ms(3) soft_uart_write("@") for i = 0 to 5 soft_uart_write(Coxa[i]) delay_us(500) next i portc.2 = 0 portc.1 = 1 error1 = Soft_UART_Init(PORTC,2, 4, 9600, 0) delay_ms(3) soft_uart_write("@") for i = 0 to 5 soft_uart_write(Thigh[i]) delay_us(500) next i portc.1 = 0 portc.0 = 1 error1 = Soft_UART_Init(PORTC,0, 3, 9600, 0) delay_ms(3) soft_uart_write("@") for i = 0 to 5 soft_uart_write(Tibia[i]) delay_us(500) next i portc.0 = 0 porta.0 = 0 return end sub
my receiver waits for the @ symbol so that is why its sent first.
Bookmarks