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.
MOD5270 Putled struggle
Re: MOD5270 Putled struggle
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.
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: MOD5270 Putled struggle
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++);
}
}