From a4c693f652bff8dbee90d8c86708f28783e18c53 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 11 Feb 2021 17:05:55 +0900 Subject: Renaming of files in preparation for code style tools. Signed-off-by: Michele Calgaro --- test/cc5x/SAMPLE1.C | 61 ------------------------------------------------ test/cc5x/sample1.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ test/cc5x/sample1.piklab | 2 +- 3 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 test/cc5x/SAMPLE1.C create mode 100644 test/cc5x/sample1.c diff --git a/test/cc5x/SAMPLE1.C b/test/cc5x/SAMPLE1.C deleted file mode 100644 index 021b5cb..0000000 --- a/test/cc5x/SAMPLE1.C +++ /dev/null @@ -1,61 +0,0 @@ - -/* global variables */ -char a; -bit b1, b2; - -/* assign names to port pins */ -bit in @ PORTB.0; -bit out @ PORTB.1; - -void sub( void) -{ - char i; /* a local variable */ - - /* generate 20 pulses */ - for ( i = 0; i < 20; i++) { - out = 1; - nop(); - out = 0; - } -} - - - -void main( void) -{ - // if (TO == 1 && PD == 1 /* power up */) { - // WARM_RESET: - // clearRAM(); // clear all RAM - // } - - /* NOTE 1: some devices have a comparator module - that have to be switched off to use certain - pins as digital IO */ - //CMCON = 0x07; // switch comparators off - - /* NOTE 2: devices having AD converter may need to - configure the pins assigned to 'in' and 'out' as - digital IO */ - //ADCON1 = .. - - /* First decide the initial output level on the - output port pins, and then define the input/ - output configuration. This avoids spikes at the - output pins. */ - - PORTB = 0b.0000.0010; /* out = 1 */ - TRISB = 0b.1111.0001; /* xxxx 0001 */ - - a = 9; /* value assigned to global variable */ - - do { - if (in == 0) /* stop if 'in' is low */ - break; - sub(); - } while ( -- a > 0); /* 9 iterations */ - - // if (some condition) - // goto WARM_RESET; - - /* main is terminated by a SLEEP instruction */ -} diff --git a/test/cc5x/sample1.c b/test/cc5x/sample1.c new file mode 100644 index 0000000..021b5cb --- /dev/null +++ b/test/cc5x/sample1.c @@ -0,0 +1,61 @@ + +/* global variables */ +char a; +bit b1, b2; + +/* assign names to port pins */ +bit in @ PORTB.0; +bit out @ PORTB.1; + +void sub( void) +{ + char i; /* a local variable */ + + /* generate 20 pulses */ + for ( i = 0; i < 20; i++) { + out = 1; + nop(); + out = 0; + } +} + + + +void main( void) +{ + // if (TO == 1 && PD == 1 /* power up */) { + // WARM_RESET: + // clearRAM(); // clear all RAM + // } + + /* NOTE 1: some devices have a comparator module + that have to be switched off to use certain + pins as digital IO */ + //CMCON = 0x07; // switch comparators off + + /* NOTE 2: devices having AD converter may need to + configure the pins assigned to 'in' and 'out' as + digital IO */ + //ADCON1 = .. + + /* First decide the initial output level on the + output port pins, and then define the input/ + output configuration. This avoids spikes at the + output pins. */ + + PORTB = 0b.0000.0010; /* out = 1 */ + TRISB = 0b.1111.0001; /* xxxx 0001 */ + + a = 9; /* value assigned to global variable */ + + do { + if (in == 0) /* stop if 'in' is low */ + break; + sub(); + } while ( -- a > 0); /* 9 iterations */ + + // if (some condition) + // goto WARM_RESET; + + /* main is terminated by a SLEEP instruction */ +} diff --git a/test/cc5x/sample1.piklab b/test/cc5x/sample1.piklab index f89a9dc..61263dc 100644 --- a/test/cc5x/sample1.piklab +++ b/test/cc5x/sample1.piklab @@ -4,7 +4,7 @@ 16F690 cc5x - SAMPLE1.C + sample1.c -- cgit v1.2.1