📄 dcm44r.a51
字号:
inc r1 ;
mov dpl,@r1 ;
c_ext_dnload_repeat:
inc r1 ;move to next data entry
mov a,@r1 ;dnload message data
movx @dptr,a ;dnload data
jnb b.0,skip_delay ;if dnloading data, skip delay
mov r6,#100 ;delay ~20 ms before writing
loop1: ;
mov a,#100 ;
loop2: ;
djnz acc,loop2 ;
djnz r6,loop1 ;
skip_delay:
inc dptr ;increment to next address,
djnz r7,c_ext_dnload_repeat ;check for more items
c_ext_dnload_exit:
ajmp local_gateway_switch ;return message
;---------------------------------------------------------------------------
;
; Entry Point: c_create_task
;
; Purpose: execute create task from message
;
; Entered From: process_rac_cmd
;
; Calls: rqcreatetask
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
;
; Returns: None
;
; Description: Gets the ITD from the message and calls rqcreatetask.
; The status return from create task is set as the
; message status, and the reply message is returned.
;
;---------------------------------------------------------------------------
c_create_tsk:
mov dptr,#c_save_msg_ptr ;save msg. ptr.
mov a,r0 ;
movx @dptr,a ;
mov a,@r1 ;point dptr to itd
mov dph,a ;
inc r1 ;
mov a,@r1 ;
mov dpl,a ;dptr => itd
call reqcreatetask ;create the task
mov b,a ;b = createtask status
mov dptr,#c_save_msg_ptr ;restore msg. pointer
movx a,@dptr ;
mov r0,a ;
add a,#message_command_ofs ;write createtask status to msg.
mov r1,a ;
mov @r1,b ;
ajmp local_gateway_switch ;return message
;---------------------------------------------------------------------------
;
; Entry Point: c_delete_task
;
; Purpose: execute delete task from message
;
; Entered From: process_rac_cmd
;
; Calls: rqdeletetask
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
;
; Returns: None
;
; Description: Gets the task_id from the message and calls rqdeletetask.
; The status return from delete task is set as the
; message status, and the reply message is returned.
;
;---------------------------------------------------------------------------
c_delete_tsk:
mov dptr,#c_save_msg_ptr ;save msg. ptr.
mov a,r0 ;
movx @dptr,a ;
mov a,@r1 ;a = task id
call reqdeletetask ;delete the task
mov b,a ;b = deletetask status
mov dptr,#c_save_msg_ptr ;restore msg. pointer
movx a,@dptr ;
mov r0,a ;
add a,#message_command_ofs ;write deletetask status to msg.
mov r1,a ;
mov @r1,b ;
ajmp local_gateway_switch ;return message
;---------------------------------------------------------------------------
;
; Entry Point: c_get_function_ids
;
; Purpose: execute get_function_ids from message
;
; Entered From: process_rac_cmd
;
; Calls: rqgetfunctionids
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
;
; Returns: None
;
; Description: Sets the function_block from the message and calls
; rqgetfunctionids and the reply message is returned.
;
;---------------------------------------------------------------------------
c_get_fn_id:
mov dptr,#c_save_msg_ptr ;save msg. ptr.
mov a,r0 ;
movx @dptr,a ;
mov dph,#0 ;point dptr to msg.data
mov dpl,r1 ;
call reqgetfunctionids ;get function ids
mov dptr,#c_save_msg_ptr ;restore msg. pointer
movx a,@dptr ;
mov r0,a ;
add a,#message_command_ofs ;write status into msg.reply
mov r1,a ;
mov @r1,#0 ;
ajmp local_gateway_switch ;return message
;---------------------------------------------------------------------------
;
; Entry Point: c_protect_rac
;
; Purpose: Turn off access capability of rac task
;
; Entered From: process_rac_cmd
;
; Calls: none
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
;
; Returns: None
;
; Description: Sets or clears the c_protect_mode flag and
; the reply message is returned.
;
;---------------------------------------------------------------------------
c_protect_rac:
cjne @r1,#0,c_rac_on ;if protect value <> 0, jump
clr c_protect_mode ;value=0, so set protect mode off
ajmp local_gateway_switch ;and return msg. to sender
c_rac_on:
setb c_protect_mode ;value=1, so set protect mode on
ajmp local_gateway_switch ;and return msg. to sender
;---------------------------------------------------------------------------
;
; Entry Point: c_reset_device
;
; Purpose: Reset device by jumping to reset vector location
;
; Entered From: process_rac_cmd
;
; Calls: none
;
; Enters: rqsystemstart
;
; Inputs: message pointer in R0
; data pointer in R1
;
; Returns: None
;
; Description: Jumps to rqsystemstart, the reset vector
;
;---------------------------------------------------------------------------
c_reset_device:
ljmp rqsystemstart
;---------------------------------------------------------------------------
;
; Entry Point: node_info
;
; Purpose: Provide node identification information.
;
; Entered From: process_rac_cmd
;
; Calls: none
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
; data count in R7
;
; Returns: None
;
; Description: Move the node name, version, mode byte, and buffer
; size into the data area, and return the message.
;
;---------------------------------------------------------------------------
node_table: DB 'i8044 21',0,0,0,0,0
node_table_length EQU $-node_table
c_node_info:
mov dptr,#node_table ;move in node name (='i8044')
mov r6,#node_table_length ;and fw_version (='21')
c_node_loop: ;
clr a ;
movc a,@a+dptr ;
mov @r1,a ;
inc dptr ;
inc r1 ;
djnz r6,c_node_loop ;
mov a,r1 ;move configuration byte into m0
subb a,#5 ;
mov r1,a ; r1 => m0
mov dptr,#0fffeh ; dptr => configuration byte
movx a,@dptr ;
mov @r1,a ;
inc r1 ;r1 => m1
mov @r1,rqbufsize ;move in maximum message size
ajmp local_gateway_switch ;return message
;---------------------------------------------------------------------------
;
; Entry Point: offline
;
; Purpose: Set a slave node to the offline state.
;
; Entered From: process_rac_cmd
;
; Calls: none
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
; data count in R7
;
; Returns: None
;
; Description: If this station is not a master, do nothing. Else,
; set the designated slave offline by setting its
; station poll entry to offline, and if this is the
; present station (= siu stad), then also set the
; siu nsnr byte to offline.
;
;---------------------------------------------------------------------------
c_offline:
jnb s_station_mode,co_pass ;if i'm not a master, do nothing
mov a,@r1 ; a = slave station addr.
acall set_slave_offline ;else set slave station offline
co_pass:
ajmp local_gateway_switch ;return message
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -