Micro-Controller Academy Program Lab Materials STMicroelectronics ST72F324J6B5 Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
1. GND 2. ICCDATA 3. GND 4. ICCCLK 5. GND 6. ICCRESET 7. VDD 8.ICCSEL_VPP 9. ICCOSC 10. GND Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Mode Syntax 1. Inherent NOP 2. Immediate LD A,#$55 3. Short Direct LD A,$10 4. Long Direct LD A,$1000 5. Indexed (No Offset) LD A,(X) 6. Short Indexed LD A,($10,X) 7. Long Indexed LD A,($1000,X) 8. Short Indirect LD A,[$10] 9. Long Indirect LD A,[$10.w] 10. Short Indirect Indexed LD A,([$10],X) 11. Long Indirect Indexed LD A,([$10.w],X) 12. Relative Direct JRNE label 13. Relative Indirect JRNE [$10] Seung Jun Sang Sa Ltd.
Mode DDR OR Floating Input 0 0 Pull-up Input 0 1 Open drain Output 1 0 Push-pull Output 1 1 Mode DDR OR Floating Input 0 0 Pull-up Interrupt Input 0 1 Open drain Output 1 0 Push-pull Output 1 1 Mode DDR OR Floating Input 0 0 Floating Interrupt Input 0 1 Open drain Output 1 0 Push-pull Output 1 1 Mode DDR OR Floating Input 0 X Open drain Output 1 X Seung Jun Sang Sa Ltd.
Register 7 6 5 4 3 2 1 0 PADR 0 0 0 0 0 X X X PADDR 1 1 1 1 1 X X X PAOR 0 0 1 1 1 X X X PBDR X X X 0 1 0 0 0 PBDDR X X X 0 1 0 1 1 PBOR X X X 0 1 0 1 1 PCDR 0 0 0 0 0 0 0 0 PCDDR 0 0 0 0 1 1 0 0 PCOR 0 0 0 0 1 1 0 0 PDDR X X 0 0 0 0 0 0 PDDDR X X 0 0 0 0 0 0 PDOR X X 0 0 0 0 0 0 PEDR X X X X X X 0 1 PEDDR X X X X X X 0 1 PEOR X X X X X X 0 1 PFDR 0 0 X 0 X 0 0 0 PFDDR 0 0 X 1 X 0 1 1 PFOR 0 0 X 1 X 0 1 1 Seung Jun Sang Sa Ltd.
: Watchdog TimerRTC, Beep(PF1). Watchdog TimerWDGCR(0x2A). WDGA bit1 Watchdog Timer WDGCR6bit1 0 RESET. WDGCR 7F, 1 3F RESET. Option ByteWDG SWHardware WDGA bit Watchdog Timer RESET. RTC TimerMCCSR(0x2C), Beep(PF1)MCCBCR(0x2D) On/Off. LD A, #$00 LD MCCSR, A CLR MCCBCR LD A, #$01 LD MCCBCR, A ; f(cpu) = f(osc2) = f(osc)/2 = 2MHz @f(osc) = 4MHz, time base = 8mS ; Beep Off ; ~500Hz @f(osc) = 4MHz ; Beep On Seung Jun Sang Sa Ltd.
RTC TimerOverflow 1 LED On/Off.. LD A, #$0E ; time base = 100mS, OIE = 1, OIF = 0 LD MCCSR, A RIM ; Interrupt Enable (I1 = 1, I0 = 0) 100mS.. INT_RTC BRES MCCSR,#0 INC COUNT LD A,COUNT CP A,#10 JRNE INT_RET CLR COUNT LD A,#$10 INT_RET IRET XOR A,PADR LD PADR,A ; A = A (XOR) PADR Seung Jun Sang Sa Ltd.
: 2x 16 LCD LCD. A B C D E F G H I J K 1 2 3 4 5 6 7 8 9 @ # $ % RS R/W E DB0 DB7 RSInstruction (L) (H) R/WRead(H: LCD -> MCU) Write(L: MCU -> LCD) E Enable 8bit(DB0 ~ 7) 4bit(DB4 ~ 7). 8bit nibble nibble. LCD. Busy Flag. Busy Flag0 LCD. Seung Jun Sang Sa Ltd.
LCD. LD A, #$28 ; Function Set, 4bit, 2, 5x8 CALL WRITE_LCD CALL BUSY_CHECK LD A, #$0E CALL WRITE_LCD CALL BUSY_CHECK LD A, #$06 CALL WRITE_LCD CALL BUSY_CHECK LD A, #$01 ; Clear Display CALL WRITE_LCD CALL BUSY_CHECK ; Display On/Off, On, Off ; Entry Mode Set, Address Counter +1, CALL DELAY ; LCD 1 ( _ ). LD A, # A CALL WRITE_DATA CALL BUSY_CHECK ; A Seung Jun Sang Sa Ltd.
: PC LCD, PC. ST72F324J6B5 PE1(RDI)/PE0(TDO). PC /. LD A,#$00 ; 1 Start bit, 8 Data bits, 1 Stop bit, Parity Control Disabled LD SCICR1,A LD A,#$00 ; PR Prescaling factor = 1, TR Dividing factor = 1, RR Dividing factor = 1 LD SCIBRR,A LD A,#13 ; Receiver Baud = 9600bps, Transmitter Baud = 9600bps LD SCIERPR,A LD SCIETPR,A LD A,#$2C ; Receiver Interrupt Enabled, Transmitter and Receiver Enabled LD SCICR2,A RIM ; Interrupt Enable (I1 = 1, I0 = 0) Seung Jun Sang Sa Ltd.
PC 1 Byte. INT_SCI BTJT SCISR,#OVR,SCI_ERR ; Overrun Error? BTJF SCISR,#RDRF,INT_RET BTJT SCISR,#NF,SCI_ERR ; Noise? BTJT SCISR,#FE,SCI_ERR ; Framing Error? LD A,SCIDR LD RXDATA,A IRET SCI_ERR LD A,SCIDR ; 0 SCIDR. INT_RET IRET PC 1 Byte. TX TX_RET BTJF SCISR,#TDRE,TX_RET LD A,TXDATA LD SCIDR,A RET / SCIDR(0x51). Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
; Interrupt Enable (I1 = 1, I0 = 0) Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.
Seung Jun Sang Sa Ltd.