PIC32 DALI2 project

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 32-bit PIC MCUs
Post Reply
Author
Message
walflucaa
Posts: 3
Joined: 14 Sep 2022 21:01

PIC32 DALI2 project

#1 Post by walflucaa » 08 Nov 2022 19:55

Good evening everyone!
I am working on a project with my DALI2 click board and thanks to the kind help of mikroe team via live chat, I finally managed to make the DALI2 example from the library work. Now I'd like to improve the project and "ask" data to the DALI2 ballast connected to the board, like lamp failure or on-off status or power level and so on. Coding is not my strength, so I'm sorry for the easy question.


I have noticed in the dali.c and dali.h folders available on github, that there is a function which allows to "grab" data from a buffer and to write it somewhere (?)
The function is dali2_getBallastResponse(); https://github.com/MikroElektronika/DAL ... 2_driver.c
Does anyone know what kind of data this function gets access to, and how can i read it (maybe on a txt file or print it on screen)? Or if there are any other ways in which I can query the ballast's data and read the answer?

Thank you for your help!
Attachments
Screenshot 2022-11-08 194044.png
Screenshot 2022-11-08 194044.png (22.05 KiB) Viewed 1253 times

AntiMember
Posts: 136
Joined: 02 Jan 2020 19:00

Re: PIC32 DALI2 project

#2 Post by AntiMember » 11 Nov 2022 20:31

This is approximate content applicationTask from example. How you will view the variable DataBack - I do not know.
You can request everything you need and put in an array of byte.

Code: Select all

	uint8_t deviceaddress = _DALI2_ADDRESS01;     // There should be a short address of your device. (From _DALI2_ADDRESS01 to _DALI2_ADDRESS63).
	uint8_t DataBack;
	
	while (dali2_masterStatus() != _DALI2_NO_ACTION);   // Checking for the lack of current operations. Can be excluded. I have nothing to check on.
        dali2_sendCmd(deviceaddress, _DALI2_QUERY_LAMP_POWER_ON, _DALI2_SHORT_ADDRESS, _DALI2_FOLLOWING_COMMAND);      // request, is the lamp enabled ?
        Delay_ms( 200 );   // There is a delay in a request and an answer. Since the library of Mikroe does not give a state that the answer is received ... :o 
        DataBack = dali2_getBallastResponse();   // Place the Ballast response in the variable DataBack.

walflucaa
Posts: 3
Joined: 14 Sep 2022 21:01

Re: PIC32 DALI2 project

#3 Post by walflucaa » 13 Nov 2022 10:54

Thank you very much!
I will try and see what happens.

walflucaa
Posts: 3
Joined: 14 Sep 2022 21:01

Re: PIC32 DALI2 project

#4 Post by walflucaa » 13 Nov 2022 11:00

Thank you very much!
I understood now. I'll try and see what happens.

Post Reply

Return to “PIC32 PRO Compilers”