pt2262 source code written by EM78P156
;this program is HOME ALARM
;
n
;this progam write and test for 01.2.18---3.5
;Chip EM78P156 F=3.58 MHz
;SETUP : CYCLE=2,CLOCK=4,ENABLE WDT
;define ram
;**********************************************************
IND == 0
RTC == 1
PC == 2
STATUS == 3
FSR == 4
RA == 5
RB == 6
;define hundred bit
;************************************************************
C == 0
Z == 2
;define ra bit
;**********************************************************
R0 == 0
R1 == 1
R2 == 2
R3 == 3
;define rb bit
;**********************************************************
SEND == 1
RFIN == 4 REC RF IN
;DEFINE INTR
;**********************************************************
INTR == 0xf
TCIF == 0
ICIF == 1
EXIF == 2
;define cont bit
;**********************************************************
PAB == 3
TE == 4
TS == 5
INT_FLG == 6
;DEFINE PULL_DOWN
;**********************************************************
IOCB == 0xb
;DEFINE OPEN_DRAIN
;**********************************************************
IOCC == 0xc
;DEFINE PULL_HIGH
;**********************************************************
IOCD == 0xd
;define wdt bit
;************************************************************
IOCE == 0xe
ROC == 4
EIS == 6
WDTE == 7
;DEFINE INT MASK
;**********************************************************
IOCF == 0xf
TCIE == 0
ICIE == 1
EXIE == 2
;define ram
;**********************************************************
FLG1 == 0x10 KEY STATUS
FLG2 == 0x11
TEMP1 == 0x12
TEMP2 == 0x13
TEMP3 == 0x14
TIME == 0x18
BITCNT == 0x19
CODECNT == 0x1f
;
;DEFINE FLG1 SEND IR
;**********************************************************
ENTX == 7
RELEASE == 0
;
;##########################################################
;**********************************************************
ORG 0x0
JMP RESET
NOP
NOP
NOP
NOP
NOP
NOP
ORG 0x10
;#########################################################
D4ms:
MOV A,@0x1f
JMP DLYX
D120us MOV A,@0x1
DLYX:
MOV TEMP1,A
DLY: MOV A,@0xf
MOV TEMP2,A
DLY4 NOP
DJZ TEMP2
JMP DLY4
DJZ TEMP1
JMP DLY
RET
;##########################################################
;*****************PROGAM RESET*****************************
RESET:
MOV A,STATUS
AND A,@0x18 GET TO PD
JBC STATUS,Z
JMP MAIN1
CLR FLG1 CLR ALL FLAG
CLR FLG2
MAIN1:
MOV A,@0xf8 DIABLE PULL_DOWN
IOW IOCB
MOV A,@0x0 DISABLE OPEN_DRAIN
IOW IOCC
MOV A,@0xfe RB0 PULL HIGH,DISABLE PULL_HIGH
IOW IOCD
MOV A,@0x80 ENABLE WDT, INT
IOW IOCE
MOV A,@0x0 ENABLE EX_INT
IOW IOCF
MOV A,@0x0 RA IN
MOV RA,A
MOV A,@0x13
MOV RB,A
CLR INTR
MAIN2:
WDTC
MOV A,@0x0 SELECT SCAL WDT=1:2
CONTW DISABLE INT
NOP
NOP
NOP
MOV A,@0xf
IOW RA
MOV A,@0x11
IOW RB
SEND_RF:
WDTC
BS RB,SEND
BC RB,2
BC RB,3
JBS FLG1,RELEASE
JBS RA,1
JMP SEND_RF_OVER
BS FLG1,RELEASE
MOV A,@0x2
MOV TIME,A
SEND_SYNC:
MOV A,@0x10
MOV BITCNT,A
SEND_ADDR:
BC RB,SEND
CALL D120us
BS RB,SEND
CALL D120us
CALL D120us
CALL D120us
DJZ BITCNT
JMP SEND_ADDR
MOV A,@0x8
MOV BITCNT,A
SEND_DATA:
BC RB,SEND
CALL D120us
CALL D120us
CALL D120us
BS RB,SEND
CALL D120us
DJZ BITCNT
JMP SEND_DATA
BC RB,SEND
CALL D120us
BS RB,SEND
WDTC
CALL D4ms
CALL D120us
CALL D120us
CALL D120us
CALL D120us
DJZ TIME
JMP SEND_SYNC
SEND_RF_OVER:
NOP
BS RB,SEND
JMP MAIN1
Previous article:EM78C156E+1621 display assembly example
Next article:Misunderstandings and skills in the application of EMC8BIT microcontroller instructions
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- bq25895 can't charge, urgent
- TMU Introduction and Usage
- DIY fan debugging welding precautions
- TI Cup National Electronic Design Competition (Excellent Works from Provincial Level)
- Analysis of driving circuit in switching power supply 7
- TMS320F28035 bidirectional 400V-12V DC/DC converter design
- Why are the component angles in the AD09 component package library all changed to 10 degrees?
- How to improve the load capacity of power chip
- ESP32 development board that looks like Raspberry Pi Zero
- Rectification and filter capacitor selection