/* **************************************************
"Zoom" short-cut buttons with Beetle
V00: Initial version May 10, 2020
Funcion: Provides four short-cut-buttons
Button 1 for Mute all members (on/off)
Button 2 for View gallery (on/off=speaker)
Button 3 for Tool-bar (on/off)
Button 4 for Full-screen (on/off)
Remarks: Apply Leonardo to build w/Arduino IDE
(c) Akira Tominaga, All rights reserved.
****************************************************
*/
#include "Keyboard.h" // for Leonardo(ATmega32U4) only
#define B1 11 // Button 1 for Mute-all
#define B2 10 // Button 2 for View-gallery
#define B3 9 // Button 3 for Toolbar
#define B4 18 //=A0 // Button 4 for Full-screen
// Chattering time depends on the Buttons used
#define Cht 30 // chattering time
#define lCht 200 // longer chtrg to ignore
#define typOn 10 // type-on time (mS)
byte Fk=KEY_F1; // save area for cur Func key
void setup() { // Setup **************************
Keyboard.begin();
// define Buttons and pull them up
pinMode(B1, INPUT_PULLUP);
pinMode(B2, INPUT_PULLUP);
pinMode(B3, INPUT_PULLUP);
pinMode(B4, INPUT_PULLUP);
}
void loop() { // Arduino loop ******************
if (digitalRead(B1) == LOW) { // B1: Mute all members
delay(Cht); // avoid chattering
while (digitalRead(B1) == LOW) {} // wait for btn-off
Keyboard.press(KEY_LEFT_ALT); // push Alter key
Keyboard.print("m"); // and type m
delay(typOn);
Keyboard.releaseAll();
delay(lCht); // avoid longer chattering
}
if (digitalRead(B2) == LOW) { // B2:View gallery or Spkr
delay(Cht); // avoid chattering
while (digitalRead(B2) == LOW) {} // wait button-off
if (Fk == KEY_F2) { // checck cur func key
Fk=KEY_F1; // set F1 if currently F2 used
} else {
Fk=KEY_F2; // set F2 if currently F1 used
}
Keyboard.press(KEY_LEFT_ALT); // push Alter key
Keyboard.press(Fk); // and push Function key 1 or 2
delay(typOn);
Keyboard.releaseAll(); // release all keys
delay(lCht); // avoid longer chattering
}
if (digitalRead(B3) == LOW) { // B3: Toolbar
delay(Cht); // avoid chattering
while (digitalRead(B3) == LOW) {} // wait button-off
Keyboard.press(KEY_LEFT_ALT); // push Alter key
delay(10);
Keyboard.releaseAll(); // release all keys
delay(lCht); // avoid longer chattering
}
if (digitalRead(B4) == LOW) { // B4: Full screen
delay(Cht); // avoid chattering
while (digitalRead(B4) == LOW) {} // wait button-off
Keyboard.press(KEY_LEFT_ALT); // push Alter key
Keyboard.print("f"); // and type f
delay(typOn);
Keyboard.releaseAll(); // release all keys
delay(lCht); // avoid longer chattering
}
}
// End of program *******************************
/* ***************************************************
"Zoom" short-cut buttons with Arduino-Micro
V00: Initial version May 9, 2020
V01,02: Ignore long chattering May 10, 2020
Funcion: Provide four short-cut-buttons
Button 1 for Mute all memabers (on/off)
Button 2 for View gallery (on/off=speaker)
Button 3 for Tool-bar (on/off)
Button 4 for Full-screen (on/off)
(c) Akira Tominaga, All rights reserved.
*****************************************************
*/
#include "Keyboard.h" // for ATmega32U4 only
#define B1 7 // Button 1 for Mute-all
#define B2 8 // Button 2 for View-gallery
#define B3 14 // Button 3 for Toolbar
#define B4 15 // Button 4 for Full-screen
// Chattering time depends on the Buttons used
#define Cht 30 // chattering time
#define lCht 200 // longer chtrg to ignore *V02
#define typOn 10 // type-on time (mS)
byte Fk = KEY_F1; // save area for cur Func key
void setup() { // Setup **************************
Keyboard.begin();
// define Buttons and pull them up
pinMode(B1, INPUT_PULLUP);
pinMode(B2, INPUT_PULLUP);
pinMode(B3, INPUT_PULLUP);
pinMode(B4, INPUT_PULLUP);
}
void loop() { // Arduino loop ******************
if (digitalRead(B1) == LOW) { // B1: Mute all members
delay(Cht); // ignore chattering
while (digitalRead(B1) == LOW) {} // wait for btn-off
Keyboard.press(KEY_LEFT_ALT); // push Alter key
Keyboard.print("m"); // and type m
delay(typOn);
Keyboard.releaseAll();
delay(lCht); // avoid longer chattering *V02
}
if (digitalRead(B2) == LOW) { // B2:View gallery or Spkr
delay(Cht); // avoid chattering
while (digitalRead(B2) == LOW) {} // wait button-off
if (Fk == KEY_F2) { // checck cur func key
Fk = KEY_F1; // set F1 if currently F2 used
} else {
Fk = KEY_F2; // set F2 if currently F1 used
}
Keyboard.press(KEY_LEFT_ALT); // push Alter key
Keyboard.press(Fk); // and push Function key 1 or 2
delay(typOn);
Keyboard.releaseAll(); // release all keys
delay(lCht); // avoid longer chattering *V02
}
if (digitalRead(B3) == LOW) { // B3: Toolbar
delay(Cht); // avoid chattering
while (digitalRead(B3) == LOW) {} // wait button-off
Keyboard.press(KEY_LEFT_ALT); // push Alter key
delay(typOn);
Keyboard.releaseAll(); // release all keys
delay(lCht); // avoid longer chattering *V02
}
if (digitalRead(B4) == LOW) { // B4: Full screen
delay(Cht); // avoid chattering
while (digitalRead(B4) == LOW) {} // wait button-off
Keyboard.press(KEY_LEFT_ALT); // push Alter key
Keyboard.print("f"); // and type f
delay(typOn);
Keyboard.releaseAll(); // release all keys
delay(lCht); // avoid longer chattering *V02
}
}
// End of program *******************************
//* **************************************************
"Zoom" short-cut buttons with Arduino-UNO
V00: Initial version for test May 1, 2020
V01: Updated Button assignment May 2, 2020
V02 For very long chatterings May 10,2020
Funcion: Provide four short-cut-buttons
Button 1 for Mute all memabers (on/off) *V01
Button 2 for View gallery (on/off=speaker)
Button 3 for Tool-bar (on/off)
Button 4 for Full-screen (on/off)
(c) Akira Tominaga, All rights reserved.
****************************************************
*/
#define B1 9 // Button 1 for Mute-all *V01
#define B2 10 // Button 2 for View-gallery
#define B3 11 // Button 3 for Toolbar
#define B4 12 // Button 4 for Full-screen
// Chattering time depends on the Buttons used
#define Cht 30 // chattering max time (mS)
#define lCht 200 // time to bypass longer chtrg
byte KbD[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // HID report
// KbD[0]=Modifier for USB HID Keyboard-code
#define rGUI B10000000 // right Windows key
#define rALT B01000000 // right Alt key
#define rSFT B00100000 // right Shift key
#define rCTL B00010000 // right Ctl key
#define lGUI B00001000 // left Windows key
#define lALT B00000100 // left Alt key
#define lSFT B00000010 // left Shift key
#define lCTL B00000001 // left Ctl key
// KbD[1] should always be 0x00
// KbD[2] to KbD[7] include key-codes (max 6 keys)
// Alphabet code = ASCIIcode-0x5D (ex.a:0x61 -> 0x04)
#define Csub 0x5D // Character value to subtract
// Special key codes
#define ScF1 0x3A // USB KB code for F1 key (Speaker)
#define ScF2 0X3B // USB KB code for F2 key (Gallery)
byte Fk=ScF1; // save area for cur Func key
void setup() { // Setup **************************
Serial.begin(9600);
// define Buttons and pull them up
pinMode(B1, INPUT_PULLUP);
pinMode(B2, INPUT_PULLUP);
pinMode(B3, INPUT_PULLUP);
pinMode(B4, INPUT_PULLUP);
}
void loop() { // Arduino loop ******************
if (digitalRead(B1) == LOW) { // B1: Mute all members
delay(Cht); // avoid chattering
while (digitalRead(B1) == LOW) {} // wait button-off
// Serial.println("B1=Mute all"); // for test only
KbD[2] = 'm' - Csub; // set character m
KbD[0] = lALT; // set ALT key
KbWrite(); // send HID-Make and Brake
}
if (digitalRead(B2) == LOW) { // B2: View gallery
delay(Cht); // avoid chattering
while (digitalRead(B2) == LOW) {} // wait button-off
// Serial.println("B2=View"); // for test only
if (Fk == ScF2) { // select function key
Fk = ScF1; // set F1 if currently F2
} else {
Fk = ScF2; // set F2 if currently F1
}
KbD[2] = Fk; // set the Func-key
KbD[0] = lALT; // set left ALT key
KbWrite(); // send HID-Make and Brake
}
if (digitalRead(B3) == LOW) { // B3: Toolbar
delay(Cht); // avoid chattering
while (digitalRead(B3) == LOW) {} // wait button-off
// Serial.println("B3=Tool"); // for test only
KbD[0] = lALT; // set left ALT key
KbWrite(); // send HID-Make and Brake
}
if (digitalRead(B4) == LOW) { // B4: Full screen
delay(Cht); // avoid chattering
while (digitalRead(B4) == LOW) {} // wait button-off
// Serial.println("B4=Scrn"); // for test only
KbD[2] = 'f' - Csub; // Set keyboard f char
KbD[0] = lALT; // set left ALT key
KbWrite(); // send HID-Make and Brake
}
}
/********************************
* *** User defined functions ***
* *****************************/
// *** KbWrite() send HID-Make and HID-Brake
void KbWrite(void)
{
Serial.write(KbD, 8); // HID-Make
KbD[2] = 0x00; // clear character
KbD[0] = 0x00; // clear modifier
Serial.write(KbD, 8); // HID-Break
delay(lCht); // to ignore longer chtrg *V02
}
マイクロソフトが提供している無料開発ツールのUSB ViewerあるいはUSB Tree Viewerのどちらかを導入して、それを使われると良いと思います。USB Tree Viewerの方が詳しい情報が得られます(が、USB Viewerの方が導入は単純です)。各名称でググっていただくとマイクロソフトの説明ページが出てきますので、必要な方は自己責任にてご導入ください。
/* **************************************************
* USB-Keyboard for Arduino-UNO *
* Test version V00 April 30, 2020 *
* (c) Akira Tominaga, All rights reserved. *
****************************************************
*/
byte KbD[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
// KbD[0]=Modifier for USB Keyboard -code
#define rGUI B10000000 // right Windows key
#define rALT B01000000 // right Alt key
#define rSFT B00100000 // right Shift key
#define rCTL B00010000 // right Ctl key
#define lGUI B00001000 // left Windows key
#define lALT B00000100 // left Alt key
#define lSFT B00000010 // left Shift key
#define lCTL B00000001 // left Ctl key
// KbD[1] shoule always be 0x00
// KbD[2] to KbD[7] include scan-codes (max 6 codes)
// Alphabet code = ASCII val-0x5D (from a=0x61 to 0x04)
#define Csub 0x5D // Character value to subtract
// Function key code F1=0x3A, F2=0x3B, etc
#define ScF1 0x3A // USB KB code for F1 key
#define ScF2 0X3B // USB KB code for F2 key
// Space key code =0x2c
#define ScSp 0x2c // USB KB code for Space key
byte Chr = 'a'-Csub; // set initial key = a
void setup() { // Setup **************************
Serial.begin(9600);
}
void loop() { // Arduino loop ******************
KbD[2] = Chr;
KbWrite();
delay(1);
Chr = Chr+0x01;
KbD[2] = Chr;
KbD[0] = 0x00+lSFT; // test modifier (Shift)
KbWrite();
delay(1);
Chr = Chr+0x01;
KbD[2] = Chr;
KbWrite();
delay(1);
KbD[2] = ScSp; // Space key
KbWrite();
Chr = Chr+0x01; // increase char code
if(Chr>'z'-Csub){ // if exceeded 'z'
Chr = 'a'- Csub; // then re-set to 'a'
}
delay(3000);
}
/********************************
* *** User defined functions ***
* *****************************/
// *** KbWrite() write character as HID KB report
void KbWrite(void)
{
Serial.write(KbD, 8); // make
KbD[2] = 0x00; // clear character
KbD[0] = 0x00; // clear modifier
Serial.write(KbD, 8); // break
}
USB keyboardは 標準USB HID(ヒューマンインターフェイスデバイス)として機能しますからドライバーの準備は不要です。差し込めば即USB keyboardとして働きますから、予めメモ帳などを開いておけばそこに文字が書き込まれていきます。上のプログラムではメモ帳に次のように出力されていきます。
;U2001-Wblinker-12F1822-V03s.asm As of Mar. 16, 2020
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Warning Blinker for PIC12F1822 Initial Version Jan.26, 2020 ;
; (c)1999-2020 Akira Tominaga, All rights reserved. ;
; V02: Shortened LED-on time from 8mS to 6mS. Feb.21, 2020 ;
; V03: Adjusted 1mS (from 5 GOTOs to 3 GOTOs) Mar.16, 2020 ;
; Changed short WDT from 512mS to 256mS Mar.16, 2020 ;
; ;
; Function ;
; Blink LED with sleep for small energy consumption ;
; (Upgraded from 12C509(without sleep) to 12F1288(with sleep) ;
; ;
; Input/Output for 16F1823 ;
; RA0 LED output (on =H) ;
; RA4 Osc2 for Clock output (CLKOUTEN_ON) for test purpose ;
; RA5 Osc1 for _EXTRC connection ;
; Remarks ;
; 1. Clock = EXTRC (as slow as possible) ;
; R=100kΩ, C=100pF → f=30kHz (500 x time of 16MHz clock) ;
; Hence 1 step ≒ 125μS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
page
list p=12F1822 ; list directive to define processor
#include ; <p12F1822.inc>specific variables
__CONFIG _CONFIG1, _FOSC_EXTRC & _WDTE_SWDTEN & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_ON & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_OFF
;
page
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Macro definitions ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Device dependent Macros ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
DEVset macro
BANKSEL OSCCON ; Bank=1
movlw B'00000000' ; Clock determined by Configuration Word 1
movwf OSCCON
;
; BANKSEL INTCON ; Interrupt Con (in all banks hence comment)
clrf INTCON ; Disable all interrupts
;
; PORTA initialization
BANKSEL PORTA ; Bank=0
clrf PORTA
BANKSEL LATA ; Bank=2
clrf LATA
BANKSEL ANSELA ; Bank=3
movlw B'00000000' ; No use of Analog input
movwf ANSELA
BANKSEL TRISA ; Bank=1
movlw B'11101110' ; RA0 and 4 are output
movwf TRISA
;
BANKSEL ADCON0 ; Bank=1
clrf ADCON0 ; No use of ADC
;
BANKSEL OPTION_REG ; Bank=1
bcf OPTION_REG,7 ; Enable weak pull-up
BANKSEL WPUA ; Bank=4
movlw B'00001000' ; Weak Pull-up for RA3
movwf WPUA ;
;
BANKSEL WDTCON ; Bank=1
clrf WDTCON ; WDT is set by program
;
clrf BSR ; Bank=0
endm
;
OUTini macro ; L for LEDs, and H for Clk, Dio
nop ; Timing for PORTA
movlw B'11001000' ; Set RA0 zero
movwf PORTA
goto $+1 ; Timing for PORTA
endm
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; I/O macros ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; For general purpose ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OUTon macro
bsf GPIO,Out
endm
;
OUToff macro
bcf GPIO,Out
endm
;
WDTonL macro ; Set long WDT
BANKSEL WDTCON
movlw B'00011001' ; Enable 4 sec WDT
movwf WDTCON
clrf BSR
endm
;
WDTonS macro ; Set short WDT
BANKSEL WDTCON
movlw B'00010001' ; Enable 256mS WDT
movwf WDTCON
clrf BSR
endm
;
WDToff macro ; Off WDT
BANKSEL WDTCON
bcf WDTCON,SWDTEN ; Disable SW Watch Dog Timer
clrf BSR
endm
;
LEDon macro
OUTon
endm
;
LEDoff macro
OUToff
endm
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Constant time consuming ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Rm1 macro Rm1p ;Consume 1 mS x n
movlw Rm1p
call Rm1r
endm
;
Rm250 macro Rm250p ; Consume 250mS x n
movlw Rm250p
call Rm250r
endm
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Debug macros ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Udebug macro Addr
movf Addr,W
call Udbgr
endm
;
Ublink macro bno ; Blink LED for specified times
movlw bno
call Ublinkr
endm
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Files and Equations ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Files ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cblock H'20' ; available from H'20' to H'6F' (80 bytes)
;
; For application
Rm1c
Rm250c
;
; Areas for debugging routine
DmpA ; Display byte area
Dmp8C ; Bit counter for loop (Initial Dmp8V =8)
BlinkC ; Counter for blinking (set for Debugb or Abendb)
;
; Both for debugging and for application
Flags ; Flag byte
;
endc
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Equations ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; For logical GPIO port ; ** Change when PORTs changed **
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GPIO equ PORTA ; GPIO is for 12C509
Out equ 0 ; Output
LED equ 0 ; LED
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Flags Byte ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LEDsv equ 0 ; LED save bit for debug
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; For Debug ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Dmp8V equ D'8' ; Debug display bit counter initial value
Debugb equ D'8' ; number of blinkings to show Debugging
Abendb equ D'30' ; number of blinkings to notify Abend
;
page
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Initializing ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
org 0
goto Startp ; Go to start entry
org 4 ; This is Interrupt entry
retfie ;
;
Startp DEVset ; Define ports
OUTini ; L for LED(0), and H for Clk and Dio
OUTon ; Indicate I am awake
Rm250 2 ; for a half second
OUToff ;
Rm250 D'8' ; Wait for 2 seconds
clrf Flags ; Clear Flags byte
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Main program ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Mainp equ $
;
;Step1 Blink LED once and wait 4 seconds
WDToff ; Off watch-dog-timer
OUTon ; Blink LED once
Rm1 6 ; for 6mS
OUToff
WDTonL ; On watch-dog-timer long
sleep ; This includes clrwdt
;
;Step2 Blink LED once again and wait 4 seconds
WDToff ; Off watch-dog-timer
OUTon ; Blink LED once
Rm1 6 ; for 6mS
OUToff
WDTonL ; On watch-dog-timer long
sleep ; This includes clrwdt
;
;Step3 Blink twice with 0.5 sec sleep and wait 4 seconds
WDToff ; Off watch-dog-timer
OUTon ; Blink LED 1st time
Rm1 6 ; for 6mS
OUToff
WDTonS ; On watch-dog-timer short
sleep ; This includes clrwdt
OUTon ; Blink LED 2ndt time
Rm1 6 ; for 6mS
OUToff
WDTonL ; On watch-dog-timer long
sleep ; This includes clrwdt
goto Mainp ; Loop forever
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Make about 1 mS x n (Rm1 macro) ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Rm1r movwf Rm1c ;
Rm1l goto $+1
goto $+1
goto $+1
decfsz Rm1c,F ;
goto Rm1l ;
;
retlw 0 ; return (for 12C509)
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 250 mS x n (Rm250 macro) ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Rm250r movwf Rm250c ;
Rm250l Rm1 D'250' ;
decfsz Rm250c,F ;
goto Rm250l ;
retlw 0 ; return (for 12C509)
;
space
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; User debug subroutine ;
; Show bit 7 to 0 ;
; of specified area ;
; by Udebug macro ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Udbgr clrf BSR ; Set Bank=0
movwf DmpA ; move data to Dmpa
;
btfss PORTA,LED ; Check if LED=on (on=High)
goto UdbLoff ; if LED=off(Low), skip saving process
bsf Flags,LEDsv ; Save LEDon status
LEDoff ; and off LED
Rm250 D'4' ; wait for 1 sec in case LED has been on
;
UdbLoff movlw Dmp8V ; set counter 8
movwf Dmp8C ; to Dmp8C
;
Udblp Ublink Debugb ; Blink for Debugging = 8 times
btfsc DmpA,7 ; check top bit 7
goto UdbOn ; if on then to UdbOn
goto UdbOff ; if off then to UdbOff
;
UdbOn LEDon
Rm250 D'20' ;
goto Udbeck
;
UdbOff LEDoff
Rm250 D'5' ;
; goto Udbeck
;
Udbeck decfsz Dmp8C,F
goto Udbnext
goto Udbend
;
Udbnext rlf DmpA,F
goto Udblp
;
Udbend Ublink Debugb ; end blinking and
Rm250 D'12' ; blank for 3 seconds to write down
;
btfss Flags,LEDsv ; Check if LED was on
goto Udbret ; no, goto return
LEDon ; if it was on, then on again
bcf Flags,LEDsv ; Clear LED save flag
;
Udbret return
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Blinking to show debug or abend ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Ublinkr movwf BlinkC
Ublinkl LEDon ; LED on
Rm1 D'10' ; for 10ms
LEDoff ; LED off
Rm1 D'50' ; for 50ms
;
decfsz BlinkC,F
goto Ublinkl
return
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; End of program ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end