WS2812B INTERFACINF WITH MS51FB9AE

Thread Starter

Missio2468

Joined Mar 18, 2022
74
Hello,
I have been integrating ws2812b with ms51fb9ae for past few days. I came to now that my one instruction takes about 1 micro seconds to complete using logic analyzer even though crystal frequency is 24MHz(This should not happen as one instruction should be completed in 41.67ns/82ns).


Sharing my code here. Please help
Time Function is taken form it library ms51.h
 

Attachments

joeyd999

Joined Jun 6, 2011
6,204
This should not happen as one instruction should be completed in 41.67ns/82ns.

No. One clock cycle is 41.67ns.

Each machine code instruction can take from 1 to 6 clock cycles to execute on this hardware.

Each C statement consists of multiple instructions*.

Based on my successful implementation of WS2812/13 on PIC hardware, the direction you have taken is going to fail.

You may have success if you write the driver in inline .asm. At 24 MHz, I have my doubts (though I have long forgotten the 8051 instruction set, and what efficiencies it may offer).

*Edit: Including a bunch of random, useless instructions -- depending on the compiler optimization level and the quality of the compiler.
 
Last edited:

BobTPH

Joined Jun 5, 2013
11,463
Hopefully, Joey is right, because if the instruction time is 1 usec, you cannot interface to WS2812. You need at least 8MHz, (max 125 nsec) instruction times to get the timing within specs.
 

BobTPH

Joined Jun 5, 2013
11,463
What part?

I left off on a doubtful note. So hopefully, I am wrong.
About the cycle time. If it is 1usec, it can never work. Assembly code, either inline or called, for the output pulses is the best bet to get the 400 and 800 nsec pulses.

I have made it work in PIC with my BobL language because I knew the complier would put out 1 instruction for a statement to set or clear a but in a port.

LATA.bit6 := 1;
LATA.bit6 := 0;

I just write the each line the number of times needed to get the desired length pulse.
 
Last edited:

Thread Starter

Missio2468

Joined Mar 18, 2022
74
About the cycle time. If it is 1usec, it can never work. Assembly code, either inline or called, for the output pulses is the best bet to get the 400 and 800 nsec pulses.

I have made it work in PIC with my BobL language because I knew the complier would put out 1 instruction for a statement to set or clear a but in a port.

LATA.bit6 := 1;
LATA.bit6 := 0;

I just write the each line the number of times needed to get the desired length pulse.
Thanks for the help I too have successfully interfaced with PIC Micro-Controller. There are videos on youtube of interfacing ws2812b with ms51fb9ae but they are only vidoes and no resources are availble elsewhere
 
Top