News:

Let's find out together what makes a PIC Tick!

Main Menu

UART with troubles

Started by midali, Nov 24, 2021, 12:49 PM

Previous topic - Next topic

joesaliba

Quote from: midali on Dec 14, 2021, 01:38 PMHi to all !

Joesaliba , the code is working right for you ?
The reading data from serial is stable, not random , but the values reader are not right . For example , ch1=1062 , ch2 = 1035 , ch3 = 473 , ch4 = 936 . Values should be around 1500 .

Thanks a lot !


Yes, all values are correct.

I changed all channels to a stick rather than a switch to test all channels, and they are correct. With trims to lower end I get 84 and the highest end about 2000, with mid stick 1021.

With the FrSky Taranis you will get from 00 to 2046.

Also note that I do not take the credit for this. I found these working from an Arduino code, and many codes I have seen all looks the same.

I only converted so it will work with PDS.


joesaliba

Midali, I think you are expecting a value from 900 to 2000 as per a normal servo PPM.

Note that the value is 11-bit, and therefore the value will vary between 00 and 2047, with midpoint 1021, and that is what I am getting.

If you need that from SBus to convert to a servo PPM value I will add another part of code to do so, but this will happen when at my PC:)

Regards

Joe

midali


   The First 4 Rx channels with mid stick, must have the same pulses values , doesn't matter if values are arround 1000 or 1500 , but its strange that each differnet channel have a lower value, looks like a lost a bit from each byte .
   I tested your code with Microzone MC6C , with 16F (  hardware signal inverted)  and 18F ( registry signal inverted )  and RCSTA.RX9 activated . I'll buy and I'll test with another RC type , maybe something is wrong with this model.
   Its very nice the protocol which read a data from usart , thank you.

   Many thanks again to Joe and to those who helped with this code !

joesaliba

Midali,

I will setup again my Futaba SBus and take a screen shot and post it here so you can see my findings.

Regards

Joe