Hi guys,
I been doing some reading again on the Freescale HCS12, and I've taken the plunge into doing some learning with it. I was thinking that the experience I have gained with PIC asm might have helped.
I'm using the Codewarrior IDE, with a MC9S12GD128 uC. To start with I thought I would write a toggle the LEDs program, however this seems to be more complex than with the PIC.
Below is my attempt to create something meaningful.
However, when I go to debug, it comes up with the following messages:
L1115: Function entry not found
L1106: Object entry not found
I have tried to google this, but I cannot make heads nor tails of wha is being discussed. Might someone be able to offer some advice?
Also, if anyone might be kind enough to offer some template I can use to set up my uC, it would be much appreciated. I might be able to concentrate on getting a program to work then, hehehe.
Regards,
Sparky
I been doing some reading again on the Freescale HCS12, and I've taken the plunge into doing some learning with it. I was thinking that the experience I have gained with PIC asm might have helped.
I'm using the Codewarrior IDE, with a MC9S12GD128 uC. To start with I thought I would write a toggle the LEDs program, however this seems to be more complex than with the PIC.
Below is my attempt to create something meaningful.
Rich (BB code):
;**************************************************************
;* LED Test Program *
;* Written by Sparky 31/03/14 *
;* Designed to toggle the LEDs of PORTA *
;**************************************************************
; Include derivative-specific definitions
INCLUDE 'mc9s12dg128.inc' ;uC on board
;------------------
;Memory locations
R1 EQU $1000
R2 EQU $1001
R3 EQU $1002
;------------------
;ORG directive
ORG $4000
Entry:
LDS #$4000 ;Stack
LDAA #$FF
STAA DDRA ;Set PORTA as output
BACK LDAA #$55 ;Load 0x55
STAA PORTA ;Display on PORTA LEDs
JSR DELAY ;Delay
LDAA #$AA ;Repeat above for 0xAA
STAA PORTA
JSR DELAY
BRA BACK
;------------------
;DELAY subroutine
DELAY
PSHB ;Save Reg A on Stack
LDAB #10 ;Change this value to see
STAB R3 ;how fast LEDs Toggle
;--10 msec delay.
;Freq. for Instruction Clock Cycle is 24MHz (1/2 of 48Mhz).
;(1/24MHz) x 10 Clk x240x100=10 msec. Overheads are excluded in this calculation.
L3 LDAB #100
STAB R2
L2 LDAB #240
STAB R1
L1 NOP ;1 Intruction Clk Cycle
NOP ;1
NOP ;1
DEC R1 ;4
BNE L1 ;3
DEC R2 ;Total Instr.Clk=10
BNE L2
DEC R3
BNE L3
;--------------
PULA ;Restore Reg A
RTS
;-------------------
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFE
DC.W Entry ;Reset Vector. CPU wakes here and it is sent to start of the code at $4000
L1115: Function entry not found
L1106: Object entry not found
I have tried to google this, but I cannot make heads nor tails of wha is being discussed. Might someone be able to offer some advice?
Also, if anyone might be kind enough to offer some template I can use to set up my uC, it would be much appreciated. I might be able to concentrate on getting a program to work then, hehehe.
Regards,
Sparky