Getting started with 13213 SRB

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Getting started with 13213 SRB

1,621件の閲覧回数
thngkl
Contributor I
Hi,
i have created a simple program using the software codes provided below. When i press "debug" in the CodeWarrior IDE, it runs well, but the led2 does not light up when SW2 is pressed on the SRB. Did i miss any important steps in the process of downloading the program to the MCU?



#include /* for EnableInterrupts macro */
#include /* include peripheral declarations */
#include "M68DEMO908GB60.h"

void main(void) {
EnableInterrupts; /* enable interrupts */
/* include your code here */

PTADD = 0; //initialize as input (Data Direction Rregister)
PTAPE = 0xf0; //Pullups on upper 4 bits

/*initialize bits 0-3 of Port F as outputs (connected to led's)*/
PTFDD = 0x0f;
LED1 = OFF;
LED2 = OFF;
LED3 = OFF;
LED4 = OFF;
LED5 = OFF;

for(;:smileywink: {
__RESET_WATCHDOG(); /* kicks the dog */
LED2 = SW2;
} /* loop forever */
}
ラベル(1)
0 件の賞賛
2 返答(返信)

351件の閲覧回数
J2MEJediMaster
Specialist I
I did a similar project, where a pushbutton on a HC(S)12 board lit up and LED when pushed. So, my processor isn't the same, but some of the ideas for trouble-shooting ought to carry across.

1) Have you tried setting the LEDs to ON just to see if they light up?

2) Have you confirmed that SW2 is configured as an input, and with the debugger, can you you set the bit change in the register when you depress SW2?

It's not clear to me that you've configured SW2 as an input from this code, but as I said, I'm using a different processor on a different board. HTH.

---Tom
0 件の賞賛

351件の閲覧回数
thngkl
Contributor I
Thanks for your advice Tom. Anyway i managed to solve the error. The led definition is wrong. I have corrected it and now it works just fine...
0 件の賞賛