Reply by Jim Peterson August 9, 20062006-08-09
Chances are your eye is unable to perceive the 1mhz or so frequency of
the flashing LED. This loop from your code needs something to slow down
to human perception speed assuming of course the previous notes
regarding the execution mode are not an issue.

while(1)
{

PORTB |= 0x20;
}

Hope that helps,

Jim



-----Original Message-----
From: m... [mailto:m...] On Behalf
Of Rakesh Krishnan
Sent: Tuesday, August 08, 2006 10:52 AM
To: m...
Subject: [m68HC11] C code for MC68C711E9 controller using Freeware GCC
Ver.3.3.6



Hi All,

I had written a simple C program for M68HC711E9 Controller using
Freeware GCC version 3.3.6. Also i compiled using GCC with vectors.c
file and Linker file memory.x

I generated the .S19 using GCC compiler and flashed it to 68HC711E9
using EVBplus2 development Board. But the C Code is not working, its not
displaying the LED in Port B.

The C Code and Memory.x (Linker command file) is as below: Please tell
me is there any problem in C code or Linker command file (memory.x) or
What might have caused the problem that LED is not blinking..?

C code:

#define REGISTER unsigned char
#define REG_BASE 0x1000
#define PORTA *(( REGISTER volatile *)(REG_BASE + 0x00))
#define PORTB *((REGISTER volatile *)(REG_BASE + 0x04))
#define M6811_PORTC *((REGISTER volatile *)(REG_BASE + 0x03))
#define M6811_DDRC *((REGISTER volatile *)(REG_BASE + 0x07))
#define M6811_PORTD *((REGISTER volatile *)(REG_BASE + 0x08))
#define M6811_DDRD *((REGISTER volatile *)(REG_BASE + 0x09))
#define PORTE *((REGISTER volatile *)(REG_BASE + 0x0A))
#define M6811_OPTION *((REGISTER volatile *)(REG_BASE + 0x39))
#define M6811_TMSK2 *((REGISTER volatile *)(REG_BASE + 0x24))
#define M6811_CONFIG *((REGISTER volatile *)(REG_BASE + 0x3F))
#define M6811_PACTL *((REGISTER volatile *)(REG_BASE + 0x26))

#define OC1M *((unsigned char volatile *)0x100C)
#define OC1D *((unsigned char volatile *)0x100D)

#define ADCTL *((unsigned char volatile *)0x1030)
#define TCTL2 *((unsigned char volatile *)0x1021)

#define BPROT *((unsigned char volatile *)0x1035)
#define TCTL1 *((unsigned char volatile *)0x1020)
#define TFLG1 *((unsigned char volatile *)0x1023)
#define TFLG2 *((unsigned char volatile *)0x1025)
#define CONFIG *((unsigned char volatile *)0x103F)
#define COPRST *((unsigned char volatile *)0x103A)
#define RAMSTARTADDR ((unsigned char volatile *)0x0000)
#define RAMENDADDR ((unsigned char volatile *)0x0100)
int __attribute__((noreturn)) main (void);
void _start (void);

main()
{
int rdata=0,wdata=0;
int loopi=0;
volatile unsigned char *PointerToRam;
_/*Set the Regsiters of 68hc11 */
M6811_OPTIonfiltered= 0xB3; _/* Update OPTION Register, RQ=NEG.EDGE,
STOP DLY, COP=1.048 Sec., A/D Confiltered= ON*/
M6811_TMSK2 = 0xC3; _/* Update OPTION Register,Set TCNT CLKS=8 uS, TOF &
RTC IRQ's ON*/
M6811_CONFIG = M6811_CONFIG & 0xE0;

M6811_PACTL = 0x8A;

M6811_DDRC &= 0x00;
M6811_PORTD = 0x24;
M6811_DDRD= 0x3C;
PORTB &= 0x00;
while(RAMSTARTADDR != RAMENDADDR)
*RAMSTARTADDR = 0x00;
RAMSTARTADDR++;
while(1)
{

PORTB |= 0x20;
}
}

void _start()
{

__asm__ __volatile__ ("lds #0x01FF");
__asm__ __volatile__ ("bra main");
}

----------------------

Memory.x:
MEMORY
{
page0 (rwx) : ORIGIN = 0x0000, LENGTH = 256
text (rx) : ORIGIN = 0xE000, LENGTH = 12287
eeprom : ORIGIN = 0xB600, LENGTH = 512
data : ORIGIN = 0x0000, LENGTH = 256
vector : ORIGIN = 0xFFC0, LENGTH = 64
}
_/* Setup the stack on the top of the data internal ram (not used). */
PROVIDE (_stack = 0x01FF-1);
PROVIDE (_io_ports = 0x1000);
_/* PROVIDE (_vectors_addr = 0xffc0); */
---------------------------------
Heres a new way to find what you're looking for - Yahoo! Answers









Reply by Rakesh Krishnan August 8, 20062006-08-08
Hi All,

I had written a simple C program for M68HC711E9 Controller using Freeware GCC version 3.3.6. Also i compiled using GCC with vectors.c file and Linker file memory.x

I generated the .S19 using GCC compiler and flashed it to 68HC711E9 using EVBplus2 development Board. But the C Code is not working, its not displaying the LED in Port B.

The C Code and Memory.x (Linker command file) is as below: Please tell me is there any problem in C code or Linker command file (memory.x) or What might have caused the problem that LED is not blinking..?

C code:

#define REGISTER unsigned char
#define REG_BASE 0x1000
#define PORTA *(( REGISTER volatile *)(REG_BASE + 0x00))
#define PORTB *((REGISTER volatile *)(REG_BASE + 0x04))
#define M6811_PORTC *((REGISTER volatile *)(REG_BASE + 0x03))
#define M6811_DDRC *((REGISTER volatile *)(REG_BASE + 0x07))
#define M6811_PORTD *((REGISTER volatile *)(REG_BASE + 0x08))
#define M6811_DDRD *((REGISTER volatile *)(REG_BASE + 0x09))
#define PORTE *((REGISTER volatile *)(REG_BASE + 0x0A))
#define M6811_OPTION *((REGISTER volatile *)(REG_BASE + 0x39))
#define M6811_TMSK2 *((REGISTER volatile *)(REG_BASE + 0x24))
#define M6811_CONFIG *((REGISTER volatile *)(REG_BASE + 0x3F))
#define M6811_PACTL *((REGISTER volatile *)(REG_BASE + 0x26))

#define OC1M *((unsigned char volatile *)0x100C)
#define OC1D *((unsigned char volatile *)0x100D)

#define ADCTL *((unsigned char volatile *)0x1030)
#define TCTL2 *((unsigned char volatile *)0x1021)

#define BPROT *((unsigned char volatile *)0x1035)
#define TCTL1 *((unsigned char volatile *)0x1020)
#define TFLG1 *((unsigned char volatile *)0x1023)
#define TFLG2 *((unsigned char volatile *)0x1025)
#define CONFIG *((unsigned char volatile *)0x103F)
#define COPRST *((unsigned char volatile *)0x103A)
#define RAMSTARTADDR ((unsigned char volatile *)0x0000)
#define RAMENDADDR ((unsigned char volatile *)0x0100)
int __attribute__((noreturn)) main (void);
void _start (void);

main()
{
int rdata=0,wdata=0;
int loopi=0;
volatile unsigned char *PointerToRam;
_/*Set the Regsiters of 68hc11 */
M6811_OPTIonfiltered= 0xB3; _/* Update OPTION Register, RQ=NEG.EDGE, STOP DLY, COP=1.048 Sec., A/D Confiltered= ON*/
M6811_TMSK2 = 0xC3; _/* Update OPTION Register,Set TCNT CLKS=8 uS, TOF & RTC IRQ's ON*/
M6811_CONFIG = M6811_CONFIG & 0xE0;

M6811_PACTL = 0x8A;

M6811_DDRC &= 0x00;
M6811_PORTD = 0x24;
M6811_DDRD= 0x3C;
PORTB &= 0x00;
while(RAMSTARTADDR != RAMENDADDR)
*RAMSTARTADDR = 0x00;
RAMSTARTADDR++;
while(1)
{

PORTB |= 0x20;
}
}

void _start()
{

__asm__ __volatile__ ("lds #0x01FF");
__asm__ __volatile__ ("bra main");
}

------------------------------

Memory.x:
MEMORY
{
page0 (rwx) : ORIGIN = 0x0000, LENGTH = 256
text (rx) : ORIGIN = 0xE000, LENGTH = 12287
eeprom : ORIGIN = 0xB600, LENGTH = 512
data : ORIGIN = 0x0000, LENGTH = 256
vector : ORIGIN = 0xFFC0, LENGTH = 64
}
_/* Setup the stack on the top of the data internal ram (not used). */
PROVIDE (_stack = 0x01FF-1);
PROVIDE (_io_ports = 0x1000);
_/* PROVIDE (_vectors_addr = 0xffc0); */




---------------------------------
Heres a new way to find what you're looking for - Yahoo! Answers