Jump to content
  • 0

ZYBO Led Blinker


DeAndreHJ

Question

Hi guys, I am planning to build a ZYBO Led Blinker controlled by ethernet communication. Essentially, what this means is that I will be controlling the blinking speed of the led on the zybo through ethernet communication. Regarding this, I would like to get some advice on how I should build the c code. I already am able to send data through TCP/IP and get it to light up the way I want it to be, meaning if I were to put 1100, the led would light up in the sequence. Sorry if this is unclear as I am new to this.

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

40 minutes ago, DeAndreHJ said:

ive attached the files. The echo.c file is the program file and the main.c file is the lwIP template file.

echo.c

main.c

Ive tried to change the last part of the echo.c part with "

void set_led(char cmd[4])
{
    uint8_t led_value = 0;

    int i;

    for (i = 0; i < cmd[4]; i++) {
        led_value = i;

    xil_printf("LED value = %X\n", led_value);
    }

    // Write LED value to AXI GPIO
    XGpio_DiscreteWrite(&led, 1, led_value);
}

"

However, it fails. Any help with this c program would be greatly appreciated.

Link to comment
Share on other sites

2 hours ago, DeAndreHJ said:

Ive tried to change the last part of the echo.c part with "

void set_led(char cmd[4])
{
    uint8_t led_value = 0;

    int i;

    for (i = 0; i < cmd[4]; i++) {
        led_value = i;

    xil_printf("LED value = %X\n", led_value);
    }

    // Write LED value to AXI GPIO
    XGpio_DiscreteWrite(&led, 1, led_value);
}

"

However, it fails. Any help with this c program would be greatly appreciated.

Basically, I want to be able to have an input that can change the frequency of the blinking of the led (making it blink faster or slower). Like the tutorial https://reference.digilentinc.com/learn/programmable-logic/tutorials/zybo-creating-custom-ip-cores/start

Link to comment
Share on other sites

Hi jpeyron,

I have followed the tutorial "Creating a Custom IP core using the IP Integrator" https://reference.digilentinc.com/learn/programmable-logic/tutorials/zybo-creating-custom-ip-cores/start and have managed to merge it with the video shown below. Now, with my sdk echo code, I would very much like to know how I could go about initialising My_PWM_Core.

 

echo.c

Link to comment
Share on other sites

Hi @DeAndreHJ,

Are you adding a custom ip and getting errors? Or are you trying to modify the echo to allow you to alter the rate the leds are blinking? If you are trying to alter the echo then the echo.c i linked above does not echo text  but rather checks for specific strings and then prints out specific text. You could alter this code to change the variable you are using to change the PWM on the LEDs. Are you able to change the PWM on the LEDs in a project without the ethernet?

thank you,

Jon

Link to comment
Share on other sites

Hi @jpeyron,

No, I am unable to do that. However, I did manage to change the duty cycle of the PWM. On the leds, whenever I have an input value, the leds would be set to that particular brightness. Now, however, I wish to change the frequency of the PWM with c code. Any advice on this area?

echo.c

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...