HCS12 Microcontroller/CodeWarrior LED Blink Tutorial — Delay Loop Explained (50 Hz on PORTB)
The Computer Engineering Notebook
0:00 / 0:00
HCS12 Microcontroller/CodeWarrior LED Blink Tutorial — Delay Loop Explained (50 Hz on PORTB)
30 просмотров · 13 дней назад
The Computer Engineering Notebook
91 подписчик
30 просмотров · 13 дней назад
Full walkthrough of an HCS12 assembly language solution that blinks an LED connected to PORTB bit 5 (PB5) at a 50 Hz frequency, assuming a 24 MHz bus clock.
This is a common embedded systems / microcontrollers course assignment using the HCS12 (Freescale/NXP). If you're working through a similar "blink an LED at X Hz" problem, this video walks through the complete process from the timing calculations to the working assembly code.
Timestamps:
0:00 – Problem statement (blink LED on PORTB bit 5 @ 50 Hz, 24 MHz bus clock)
0:40 – Calculating the period (T = 1/f) and drawing the waveform
1:30 – Flowchart
2:20 – Converting time to clock cycles (24 MHz → cycles needed for 0.01 sec)
2:55 – Writing the delay loop skeleton (LDY, DEY, BNE)
3:25 – Checking BNE/DEY cycle timing in the HCS12 instruction reference
4:10 – Solving for the loop count and checking the 16-bit register limit (65,535)
5:38 – Setting up the project in CodeWarrior (main.asm)
6:20 – Writing the main program: setting PORTB as output and turning the LED ON/OFF
8:37 – Writing the complete Delay subroutine
9:10 – Reviewing the finished assembly code
10:10 – Loading the program into the True-Time Simulator/debugger
10:30 – Setting up the LED in the Visualization Tool (port, bit, colors)
12:30 – Running the simulation — LED blinking at 50 Hz
#HCS12 #EmbeddedSystems #AssemblyLanguage #Microcontroller #CodeWarrior