📄 www8051.asm
字号:
.nolist.include "param.inc".include "8019.inc".list.if (MAGIC ^ VERSION) .print "Invalid ACTIVESTACK/DUALSTACK/SERIAL setings" .err.endif.include "ether.inc".include "ip.inc"; "http" .global STACK1MODE .equ STACK1MODE, NORESENDMODE .global ETHRETRY1 .equ ETHRETRY1, 5*2 ; timeout = 2 s .global PORT1 ; local port .equ PORT1, 80 .text .global open_stack1 .global process_stack1 .global close_stack1open_stack1: ljmp open_httpprocess_stack1: ljmp httpclose_stack1: ret .rdata.global data_addr.global data_len.global unwrited.global mac_gateway.global state80state80: .ds.b 1data_addr: .ds 1 ;start of data in TCP packetdata_len: .ds 1 ;length of data in TCP packetunwrited: .ds 1 ;unwrited data lengthmac_gateway: .ds 3;PCODE DATA.global chkacc, chklen, chkaddr.global pcodeMSB, pcodeLSBchkacc: .ds 1chklen: .ds 1chkaddr: .ds 1pcodeMSB: .ds.b 1pcodeLSB: .ds.b 1.comm tempDS1822LSB,1.comm tempDS1822MSB,1.equ DQ, 0x90 ; P1.0;;#########################################################; Main Loop;######################################################### .section fast, #alloc;************************************************************* .section slow, #alloc;*************************************************************;*************************************************************.section reset_device, #alloc;************************************************************* lcall DS1Reset; ROUTINES .text;*************************************************************.global DS1822_chipsDS1822_chips:;;.byte 0x22,0xC1,0x42,0x02,0x00,0x00,0x00,0x50 ;plastik.byte 0x22,0x2D,0x2F,0x02,0x00,0x00,0x00,0xF9 ;plastik.byte 0x28,0x87,0x05,0x0B,0x00,0x00,0x00,0x37 ;kov.global getDS1822 ;Reading TemperturegetDS1822: lcall DS1Reset mov A,#0xCC ; skip ROM lcall DS1Wr mov A,#0xBE ; read scratchpad lcall DS1Wr lcall DS1Rd mov tempDS1822LSB,A lcall DS1Rd mov tempDS1822MSB,A lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Reset mov A,#0xCC ; skip ROM lcall DS1Wr mov A,#0x44 ; convert ljmp DS1Wr.global getDS1822_MULTI ;Reading Temperture - more chips on 1WIREgetDS1822_MULTI: ;IN DPTR ADRESS TO 8 BYTE CHIP NUMBER lcall DS1Reset mov A,#0x55 ; DEFINE ADRESS of CHIP - for reading lcall DS1Wr mov R7,#0DS1822_MULTI_Z: mov A,R7 movc A,@A+DPTR lcall DS1Wr ;Write CHIP Address inc R7 cjne R7,#8,DS1822_MULTI_Z mov A,#0xBE ; read scratchpad lcall DS1Wr lcall DS1Rd mov tempDS1822LSB,A lcall DS1Rd mov tempDS1822MSB,A lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Rd lcall DS1Rd mov A,tempDS1822LSB ;TEST for chip without this adress cpl A JNZ DS1822_MULTI_ADR_OK mov A,tempDS1822MSB CPL A JNZ DS1822_MULTI_ADR_OK setb C ;chip not found retDS1822_MULTI_ADR_OK: lcall DS1Reset mov A,#0x55 ; DEFINE ADRESS of CHIP fo Convert TT lcall DS1Wr mov R7,#0DS1822_MULTI_B: mov A,R7 movc A,@A+DPTR lcall DS1Wr ;Write CHIP Address inc R7 cjne R7,#8,DS1822_MULTI_B mov A,#0x44 ; convert TEMPERATURE lcall DS1Wr clr C ;chip found ret ;; END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -