📄 main.lst
字号:
472 < C_IOB_Buf0: EQU %00000001 ; Output data Latch of PORTB bit0.
473 < P_IOC_Buf: EQU $5B
474 < C_IOC_Buf3: EQU %00001000 ; Output data Latch of PORTC bit3.
475 < C_IOC_Buf2: EQU %00000100 ; Output data Latch of PORTC bit2.
476 < C_IOC_Buf1: EQU %00000010 ; Output data Latch of PORTC bit1.
477 < C_IOC_Buf0: EQU %00000001 ; Output data Latch of PORTC bit0.
478 < P_IOD_Buf: EQU $5C
479 < C_IOD_Buf2: EQU %00000100 ; Output data Latch of PORTD bit2.
480 < C_IOD_Buf1: EQU %00000010 ; Output data Latch of PORTD bit1.
481 < C_IOD_Buf0: EQU %00000001 ; Output data Latch of PORTD bit0.
482 < C_RAM_ADDR: EQU $60 ; RAM Start Address
483 < C_STACK_BOTTOM: EQU $0FF ; Stack Bottom Address
484 <
485 < CB_Bit7 EQU 7 ; for bit mode
486 < CB_Bit6 EQU 6 ;
487 < CB_Bit5 EQU 5 ;
488 < CB_Bit4 EQU 4 ;
489 < CB_Bit3 EQU 3 ;
490 < CB_Bit2 EQU 2 ;
491 < CB_Bit1 EQU 1 ;
492 < CB_Bit0 EQU 0 ;
493 ;************************************************************************************
494 ;************************************************************************************
495 ;* *
496 ;* Data memory Define *
497 ;* *
498 ;************************************************************************************
499 00000060 .PAGE0 ;Define values in the range from 00h to FFh
500 ;************************************************************************************
501 000001E0 .DATA ;Define data storage section
502 ;************************************************************************************ *
503 ;* Program Area *
504 ;***********************************************************************************
505 0000F000 .CODE
506 .INCLUDE RF.asm
507 < ;==================================================================================
508 < ; The information contained herein is the exclusive property of
509 < ; Sunplus Technology Co. And shall not be distributed, reproduced,
510 < ; or disclosed in whole in part without prior written permission.
511 < ; (C) COPYRIGHT 2004 SUNPLUS TECHNOLOGY CO.
512 < ; ALL RIGHTS RESERVED
513 < ; The entire notice above must be reproduced on all authorized copies.
514 < ;==================================================================================
515 <
516 < ;==================================================================================
517 < ; Program Name : RF.asm
518 < ; Description : RF communication operation
519 < ; Reference : SPMC65P2404A/2408A Data Sheet
520 < ; Revision history :
521 < ;----------------------------------------------------------------------------------
522 < ; Version Date Description
523 < ; 1.0.0 2005-1-21 First Edition
524 < ;==================================================================================
525 <
526 < .SYNTAX 6502 ;Process standard 6502 addressing syntax
527 < .LINKLIST ;Generate linklist information
528 < .SYMBOLS ;Generate symbolic debug information
529 < ;**********************************************************************************
530 < ;constant
531 < CB_CmpTimers EQU 6 ;The maximum times of compare
532 < ;**********************************************************************************
533 00000060 < .PAGE0
534 < ;key scan
535 00000060 FF < GB_KeyDownFlag DS 1 ;Keys-down flag
536 00000061 FF < IB_KeyupFlag DS 1 ;Keys-up flag
537 00000062 FF < IB_CmpTimers DS 1 ;The equal times of Keys value
538 00000063 FF < IB_ShowBuf DS 1 ;When key pressed,IB_ShowBuf add 1 for showing
539 <
540 < ;send datas
541 00000064 FF < GB_Lock_Num DS 1 ;Delay before sending indexical data
542 00000065 FF < GB_Send_Flag DS 1
543 < C_Head_Allow: EQU $1 ;Allow to send indexical data flag
544 < C_Start_Allow: EQU $2 ;Allow to send starting data flag
545 < C_ID_Allow: EQU $4 ;Allow to send ID word flag
546 < C_Data1_Allow: EQU $8 ;Allow to send data1 flag
547 < C_Data2_Allow: EQU $10 ;Allow to send data2 flag
548 < C_Data3_Allow: EQU $20 ;Allow to send data3 flag
549 < C_Data4_Allow: EQU $40 ;Allow to send data4 flag
550 < C_Send_Allow: EQU $80 ;Allow to send flag
551 <
552 00000066 FF < GB_Sending_Flag DS 1
553 < C_Sending: EQU $1 ;Sending one bit flag
554 < C_Sending_Bit: EQU $2 ;0:sending 0; 1:sending 1
555 < C_Send_8BitEnd: EQU $4 ;One byte sending end flag
556 < C_Send_40BitEnd: EQU $8 ;Five byte sending end flag
557 00000067 FF < IB_Bit_number DS 1 ;The numbers of bit that have been send
558 <
559 00000068 FF < GB_DataBuf DS 1 ;Data to be sended
560 < C_ID_Buf: EQU $AA ;ID word
561 00000069 FF < IB_470us_Count DS 1 ;Time base for sending
562 <
563 < ;receive datas
564 0000006A FF < GB_Receive_Flag DS 1
565 < C_Rece_Allow: EQU $1 ;Allow to receive flag
566 < C_ReceInit_Allow: EQU $2 ;Initialize receive flag
567 < C_ReceStart_Allow: EQU $4 ;Allow to receive starting data flag
568 < C_ReceID_Allow: EQU $8 ;Allow to receive ID data flag
569 < C_ReceEnd_Allow: EQU $10 ;Receiving end flag
570 <
571 0000006B FF < G_RF_Time DS 1 ;The latest capture data
572 0000006C FF FF FF FF < G_RF_data DS 5 ;The datas received
FF
573 00000071 FF < G_RF_Number DS 1 ;The numbers of bit that has been received
574 < C_RF_Number: EQU 40 ;40 bits to receive flag
575 000001E0 < .DATA
576 < ;**********************************************************************************
577 0000F000 < .CODE
578 < ;==================================================================================
579 < ; Function: F_Receive_Init
580 < ; Description: Initialize receiving
581 < ; Input: GB_Send_Flag
582 < ; GB_Receive_Flag
583 < ; Output: GB_Receive_Flag
584 < ; Destroy: A
585 < ; Stacks: 1
586 < ;==================================================================================
587 0000F000 < F_Receive_Init:
588 0000F000 A5 65 < lda GB_Send_Flag ;In sending mode
589 0000F002 D0 41 < bne ?L_Send_Mode ;yes
590 <
591 0000F004 A5 6A < lda GB_Receive_Flag
592 0000F006 29 01 < and #C_Rece_Allow ;In receiving mode
593 0000F008 D0 0C < bne ?L_Receive_Init ;yes
594 <
595 0000F00A A5 6A < lda GB_Receive_Flag
596 0000F00C 09 03 < ora #(C_Rece_Allow+C_ReceInit_Allow);set receiving mode
597 0000F00E 85 6A < sta GB_Receive_Flag
598 <
599 0000F010 A5 01 < lda P_IOB_Data
600 0000F012 29 5F < and #%01011111 ;enter receiving mode
601 0000F014 85 01 < sta P_IOB_Data
602 <
603 0000F016 < ?L_Receive_Init:
604 0000F016 A5 6A < lda GB_Receive_Flag
605 0000F018 29 02 < and #C_ReceInit_Allow ;Initialize receiving?
606 0000F01A F0 35 < beq ?L_Receive_Init_Exit ;no
607 < ;------------------------------
608 < ;initialize cap3
609 < ;falling clear, falling INT
610 0000F01C A9 00 < lda #$00 ;Set Timer3 preload counter= 0
611 0000F01E 85 1C < sta P_TMR3_Preload
612 0000F020 A9 60 < lda #C_T3FCS_Div_512 ;Set Timer3 clock source is Fcs/512
613 0000F022 85 19 < sta P_TMR2_3_Ctrl1
614 0000F024 A9 30 < lda #C_T38B_CAP ;Set Timer3 is 8-bit capture
615 0000F026 85 18 < sta P_TMR2_3_Ctrl0
616 <
617 0000F028 A9 00 < lda #0 ;Falling edge clear counter
618 0000F02A 85 34 < sta P_IRQ_Opt1
619 0000F02C 85 34 < sta P_IRQ_Opt1
620 <
621 0000F02E A9 20 < lda #$20 ;Be same with CAP3ES edge setting
622 0000F030 85 58 < sta P_CAP_Ctrl
623 <
624 0000F032 A9 FF < lda #$FF ;clear INT request flag
625 0000F034 85 0C < sta P_INT_Flag0
626 0000F036 A9 02 < lda #C_INT_CAP3IE ;Capture3 INT enable
627 0000F038 85 0D < sta P_INT_Ctrl0
628 <
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -