The functionality of the code is briefly described in Figure 1. After the hardware configurations mentioned in the previous chapter through the MCC selection steps, the demo application counts every push of the button, stores the value in a byte and will further send DALI-2 frames. In case of the frames with more than one byte of data, the first one will contain the counted value and the others will be filled with zeros.
manchester_encoder.c
and manchester_encoder.h
files to the project. These files implement the DALI-2 frame transmissions providing
‘DALI_Send_Frame(block_of_bytes, number_of_bytes)
’ function, which takes
as a first argument a block of bytes representing the data of the frame, and as a second
argument, the number of bytes. In conclusion, both forward and backward frames can be sent
by calling the same function but with a different number for the second argument (1 for
backward and 2 for forward).main()
’, after the
initializing procedures, the user must enable the global and peripheral interrupts required
by TMR8.while (1)
’, the state
of the buttons is checked and, if a button is clicked, the respective counter is incremented
and a DALI-2 frame is sent.