MOD5270 Putled struggle

Discussion to talk about software related topics only.
Post Reply
pronem
Posts: 2
Joined: Fri Jul 27, 2012 7:18 am

MOD5270 Putled struggle

Post by pronem »

Hi,

I have started a new project on my MOD5270 after 2 years. Tried to start with a basic putleds project. Somehow Leds do not go on. Any guidance. See code below.

#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>


extern "C" {
void UserMain(void * pd);
}

const char * AppName="TestBasics";

void UserMain(void * pd) {
InitializeStack();
if (EthernetIP == 0) GetDHCPAddress();
OSChangePrio(MAIN_PRIO);
EnableAutoUpdate();
StartHTTP();

putleds(0x04);
iprintf("Led 4\n");

iprintf("Application started TestBasics \n");
while (1) {
OSTimeDly(20);
}
}

Appreciate some help.
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: MOD5270 Putled struggle

Post by rnixon »

Try using the pins class instead. In my tool set it says putleds is deprecated. That's actually a good thing since it only applies to the dev board.
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: MOD5270 Putled struggle

Post by Ridgeglider »

The simple code below works on a Mod5270 and the 5270LC Dev board running under the 2.6.3 code release (which is a bit dated). I seem to remember that putleds() differs depending on whether you're running on the small Dev70 "LC" board, or the Dev 100 board because different IO is connected to the LEDs on the two boards. You mentioned that you were running code that might be 2 years old. The 2.6.3 (and possibly earlier) release checks to see which board you are running: the Dev70 "LC" or the Dev100 board and modifies putleds() accordingly. I have a vague recollection that the function putleds() failed on older code releases running on the Dev70LC board because it assumed a Dev100 board. Maybe you need to update your system if the code below fails in your installation.

Code: Select all

#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <autoupdate.h>


extern "C" {
void UserMain(void * pd);
}

const char * AppName="TestLeds";

void UserMain(void * pd) {
    InitializeStack();
    OSChangePrio(MAIN_PRIO);
    EnableAutoUpdate();


    iprintf("Application started: %s\n", AppName);
    BYTE LedValue = 0;
    while (1) {
        OSTimeDly(1);
        iprintf("LedValue = %d\r\n", LedValue);
        putleds(LedValue++);

    }
}
Post Reply