You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <gjh...@us...> - 2003-06-06 17:53:32
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv8895 Modified Files: Makefile Log Message: - removed fixed_point.o, added dac_output.o Index: Makefile =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/Makefile,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Makefile 5 Jun 2003 18:06:11 -0000 1.20 --- Makefile 6 Jun 2003 17:27:12 -0000 1.21 *************** *** 14,18 **** LDFLAGS = -g -Wl,-Map,${MAPFILE} ! OBJS = main.o adc_input.o fixed_point.o bell103_modem.o \ testsignals.o detect_1kHz.o pll_control.o i2c_bus.o timers.o \ lcd_module.o uart_receive.o date_display.o --- 14,18 ---- LDFLAGS = -g -Wl,-Map,${MAPFILE} ! OBJS = main.o adc_input.o bell103_modem.o dac_output.o\ testsignals.o detect_1kHz.o pll_control.o i2c_bus.o timers.o \ lcd_module.o uart_receive.o date_display.o |
From: <gjh...@us...> - 2003-06-06 17:41:59
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv10546 Modified Files: dac_output.c Log Message: - split into inlined portion and non-inlined portion - fixed formatting Index: dac_output.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/dac_output.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dac_output.c 29 May 2003 04:46:46 -0000 1.5 --- dac_output.c 6 Jun 2003 17:30:28 -0000 1.6 *************** *** 1,2 **** --- 1,3 ---- + #ifndef INLINE_ADC_STUFF #include "avr/protos.h" #include "avr/global.h" *************** *** 6,13 **** /* Output the filtered samples to a TLV5623 8-bit SPI DAC */ - - #define DAC_FAST 0x4000 - #define DAC_SLOW 0x0000 - register unsigned char spi_busy asm("r3"); register unsigned char spi_dac_value_lsb asm("r6"); --- 7,10 ---- *************** *** 15,35 **** void spi_setup( void ) { /* Initialize SPI Busy */ spi_busy = 0; - /* Setup SCK */ - sbi( DDRB, 7 ); - - /* Setup MISO */ - cbi( DDRB, 6 ); - - /* Setup MOSI */ - sbi( DDRB, 5 ); - /* Drive SS high before setting as an output */ sbi( PORTB, 4 ); ! /* Setup SS */ ! sbi( DDRB, 4 ); /* Make sure that the CLK2X bit is cleared */ --- 12,30 ---- void spi_setup( void ) { + unsigned char reg; + /* Initialize SPI Busy */ spi_busy = 0; /* Drive SS high before setting as an output */ sbi( PORTB, 4 ); ! /* Setup SCK (PB7 output), MISO (PB6 input), MOSI (PB5 output), ! * SS (PB4 output) ! */ ! reg = inp( DDRB ); ! reg &= 0x0F; ! reg |= 0xB0; ! outp( reg, DDRB ); /* Make sure that the CLK2X bit is cleared */ *************** *** 45,49 **** } ! static inline void __attribute__ ((always_inline)) dac_send( unsigned char value ) { unsigned int dac_value; --- 40,76 ---- } ! /* Normally, you would use SIGNAL(SIG_SPI) to do this, but I wanted to tune ! * this puppy to use a LOT less CPU. The C version pushed and pulled too ! * much. ! */ ! void __attribute__ ((pure)) __attribute__ ((naked)) SIG_SPI( void ) ! { ! asm volatile ( ! "push r0" "\n\t" ! "in r0, 0x3F" "\n\t" ! "dec r3" "\n\t" ! "breq L_%=a" "\n\t" ! "out 0x0F, r6" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! "L_%=a:" "\n\t" ! "sbi 0x18, 4" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! : ! ); ! } ! ! #else ! ! #define DAC_FAST 0x4000 ! #define DAC_SLOW 0x0000 ! ! register unsigned char spi_busy asm("r3"); ! register unsigned char spi_dac_value_lsb asm("r6"); ! ! FORCE_INLINE void dac_send( unsigned char value ) { unsigned int dac_value; *************** *** 73,97 **** } ! /* Normally, you would use SIGNAL(SIG_SPI) to do this, but I wanted to tune ! * this puppy to use a LOT less CPU. The C version pushed and pulled too ! * much. ! */ ! void __attribute__ ((pure)) __attribute__ ((naked)) SIG_SPI( void ) ! { ! asm volatile ( ! "push r0" "\n\t" ! "in r0, 0x3F" "\n\t" ! "dec r3" "\n\t" ! "breq L_%=a" "\n\t" ! "out 0x0F, r6" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! "L_%=a:" "\n\t" ! "sbi 0x18, 4" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! : ! ); ! } --- 100,103 ---- } ! #endif ! |
From: <gjh...@us...> - 2003-06-06 17:40:00
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv10215 Modified Files: bell103_modem.c Log Message: - minor comment change Index: bell103_modem.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/bell103_modem.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** bell103_modem.c 2 Jun 2003 15:46:41 -0000 1.14 --- bell103_modem.c 6 Jun 2003 17:29:36 -0000 1.15 *************** *** 126,130 **** initialize_average( &average_2225Hz ); ! /* Setup PD1 */ sbi( PORTD, 1 ); sbi( DDRD, 1 ); --- 126,130 ---- initialize_average( &average_2225Hz ); ! /* Setup PD1, is UART TxD, so idle high */ sbi( PORTD, 1 ); sbi( DDRD, 1 ); |
From: <gjh...@us...> - 2003-06-06 17:39:10
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv13211 Modified Files: timers.c Log Message: - comment changes Index: timers.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/timers.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** timers.c 5 Jun 2003 20:41:23 -0000 1.9 --- timers.c 6 Jun 2003 17:35:57 -0000 1.10 *************** *** 71,75 **** * too much. * ! * Gets hit every 1ms, increments the tick timer */ void __attribute__ ((pure)) __attribute__ ((naked)) SIG_OUTPUT_COMPARE0( void ) --- 71,81 ---- * too much. * ! * Gets hit every 1ms, increments the tick timer. The msTimeTicks is tick ! * adjusted using usTimeAdj as this accounts for the time spent in the ! * handler, keeping the RTC as accurate as possible. The UART RX timeout is ! * not tick adjusted. ! * ! * Tick overflow is signalled to the mainline by setting timeTickOverflow to ! * non-zero. */ void __attribute__ ((pure)) __attribute__ ((naked)) SIG_OUTPUT_COMPARE0( void ) *************** *** 176,180 **** * too much. * ! * Gets hit every 125us, starts an A/D reading if enabled */ void __attribute__ ((pure)) __attribute__ ((naked)) SIG_OVERFLOW1( void ) --- 182,187 ---- * too much. * ! * Gets hit every 128us, sets the new PWM duty cycle for the LCD ! * contrast */ void __attribute__ ((pure)) __attribute__ ((naked)) SIG_OVERFLOW1( void ) |
From: <gjh...@us...> - 2003-06-06 17:38:09
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv14170 Modified Files: average.c Log Message: - formatting change Index: average.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/average.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** average.c 5 Mar 2003 05:42:51 -0000 1.1 --- average.c 6 Jun 2003 17:38:05 -0000 1.2 *************** *** 8,12 **** fixed16 average_power_calc( average_params *params, fixed16 filteredSample ) { ! register fixed16 temp; /*asm ("r12"); */ register fixed16 *term; --- 8,12 ---- fixed16 average_power_calc( average_params *params, fixed16 filteredSample ) { ! register fixed16 temp; register fixed16 *term; |
From: <gjh...@us...> - 2003-06-06 17:37:32
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv13604 Modified Files: uart_receive.c Log Message: - formatting change - When received a full frame, reset buffer pointer - When received an A or B frame, recalcuate day of month and day of week Index: uart_receive.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/uart_receive.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** uart_receive.c 30 May 2003 20:37:05 -0000 1.4 --- uart_receive.c 6 Jun 2003 17:37:28 -0000 1.5 *************** *** 61,70 **** /* Since the CHU protocol has nibble-swapped the data, swap it back now */ asm volatile ( ! "swap %0" "\n\t" ! : "+&r" (recv) ); if( uartRxTimeout == 0 ) { ! uartRxBuf = uartRxBufHead; } --- 61,70 ---- /* Since the CHU protocol has nibble-swapped the data, swap it back now */ asm volatile ( ! "swap %0" "\n\t" ! : "+&r" (recv) ); if( uartRxTimeout == 0 ) { ! uartRxBuf = uartRxBufHead; } *************** *** 73,137 **** if( uartRxBuf != uartRxBufTail ) { ! uartRxBuf++; } else { ! ab = 0xFF; ! /* We got a whole stream. Decode it */ ! for( i = 0; i < 5; i++ ) { if( uartRxBufStore[i] == uartRxBufStore[i+5] ) { ! if( ab == 1 ) { /* Ummm. This started off as a B frame, now it's A. ! * Turf it. ! */ ! ab = 0xFF; ! break; ! } ! ab = 0; ! } else if( uartRxBufStore[i] == ! (unsigned char)~(uartRxBufStore[i+5]) ) { ! if( ab == 0 ) { ! /* Ummm. This started off as an A frame, now it's B. ! * Turf it. ! */ ! ab = 0xFF; ! break; ! } ! ab = 1; ! } ! } ! if( ab == 0 ) { ! /* We have an A frame */ ! asm volatile ( ! "lds r25, uartRxBufStore" "\n\t" ! "andi r25, 0x0F" "\n\t" ! "lds r24, uartRxBufStore+1" "\n\t" ! "call dateJulianBCDtoInt" "\n\t" ! "sts timeJulianDate+1, r25" "\n\t" ! "sts timeJulianDate, r24" "\n\t" ! "lds r24, uartRxBufStore+2" "\n\t" ! "sts timeHour, r24" "\n\t" ! "lds r24, uartRxBufStore+3" "\n\t" ! "sts timeMinute, r24" "\n\t" ! "lds r24, uartRxBufStore+4" "\n\t" ! "sts timeSecond, r24" "\n\t" ! : ! : ! : "r24", "r25" ! ); ! } else if( ab == 1 ) { ! /* We have a B frame */ ! asm volatile ( ! "lds r25, uartRxBufStore+1" "\n\t" ! "lds r24, uartRxBufStore+2" "\n\t" ! "sts timeYearBCD+1, r25" "\n\t" ! "sts timeYearBCD, r24" "\n\t" ! "call dateYearBCDtoInt" "\n\t" ! "sts timeYear+1, r25" "\n\t" ! "sts timeYear, r24" "\n\t" ! : ! : ! : "r24", "r25" ! ); ! } } } --- 73,140 ---- if( uartRxBuf != uartRxBufTail ) { ! uartRxBuf++; } else { ! /* Restart the buffer on the next received char */ ! uartRxBuf = uartRxBufHead; ! ! ab = 0xFF; ! /* We got a whole stream. Decode it */ ! for( i = 0; i < 5; i++ ) { if( uartRxBufStore[i] == uartRxBufStore[i+5] ) { ! if( ab == 1 ) { /* Ummm. This started off as a B frame, now it's A. ! * Turf it. ! */ ! ab = 0xFF; ! break; ! } ! ab = 0; ! } else if( uartRxBufStore[i] == ! (unsigned char)~(uartRxBufStore[i+5]) ) { ! if( ab == 0 ) { ! /* Ummm. This started off as an A frame, now it's B. ! * Turf it. ! */ ! ab = 0xFF; ! break; ! } ! ab = 1; ! } ! } ! if( ab == 0 ) { ! /* We have an A frame */ ! asm volatile ( ! "lds r25, uartRxBufStore" "\n\t" ! "andi r25, 0x0F" "\n\t" ! "lds r24, uartRxBufStore+1" "\n\t" ! "call dateJulianBCDtoInt" "\n\t" ! "sts timeJulianDate+1, r25" "\n\t" ! "sts timeJulianDate, r24" "\n\t" ! "lds r24, uartRxBufStore+2" "\n\t" ! "sts timeHour, r24" "\n\t" ! "lds r24, uartRxBufStore+3" "\n\t" ! "sts timeMinute, r24" "\n\t" ! "lds r24, uartRxBufStore+4" "\n\t" ! "sts timeSecond, r24" "\n\t" ! "call dateParseMonthDay" "\n\t" ! "call dateGetDayOfWeek" "\n\t" ! : : : "r24", "r25" ! ); ! } else if( ab == 1 ) { ! /* We have a B frame */ ! asm volatile ( ! "lds r25, uartRxBufStore+1" "\n\t" ! "lds r24, uartRxBufStore+2" "\n\t" ! "sts timeYearBCD+1, r25" "\n\t" ! "sts timeYearBCD, r24" "\n\t" ! "call dateYearBCDtoInt" "\n\t" ! "sts timeYear+1, r25" "\n\t" ! "sts timeYear, r24" "\n\t" ! "call dateParseMonthDay" "\n\t" ! "call dateGetDayOfWeek" "\n\t" ! : : : "r24", "r25" ! ); ! } } } |
From: <gjh...@us...> - 2003-06-06 17:35:22
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv12893 Modified Files: testsignals.c Log Message: - minor comment changes Index: testsignals.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/testsignals.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testsignals.c 29 May 2003 04:46:46 -0000 1.4 --- testsignals.c 6 Jun 2003 17:35:16 -0000 1.5 *************** *** 3,12 **** /* These test samples are from the chu package found at: ! * http://www.rossi.com/chu/ */ #if !REAL_ADC ! /* This SHOULD be a short blip of a 1kHz tone followed by silence */ unsigned char __attribute__((progmem)) rom_testsignal1[200] = { 0xC3, 0xDF, 0xC3, 0x80, 0x3D, 0x21, 0x3D, 0x80, --- 3,14 ---- /* These test samples are from the chu package found at: ! * http://www.rossi.com/chu/ (for the 1kHz part) and interpolated by ! * hand for the 2kHz and 500Hz sections */ #if !REAL_ADC ! /* This SHOULD be a short blip of a 1kHz tone followed by silence, some 2kHz, ! * silence, some 500Hz, silence */ unsigned char __attribute__((progmem)) rom_testsignal1[200] = { 0xC3, 0xDF, 0xC3, 0x80, 0x3D, 0x21, 0x3D, 0x80, |
From: <gjh...@us...> - 2003-06-06 17:34:37
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv12098 Modified Files: main.c Log Message: - make the tick overflow check and LCD update be done not only when an ADC reading is complete. When idling, any of the three can be done. Index: main.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/main.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** main.c 2 Jun 2003 17:28:03 -0000 1.17 --- main.c 6 Jun 2003 17:34:32 -0000 1.18 *************** *** 61,64 **** --- 61,66 ---- adc_get_sample(); #if REAL_ADC + } + #endif /* Check for RTC overflow */ *************** *** 70,75 **** /* Update a character on the screen */ lcdUpdateChar(); - } - #endif } --- 72,75 ---- |
From: <gjh...@us...> - 2003-06-06 17:34:26
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv9577 Modified Files: adc_input.c Log Message: - fixed formatting, switched to FORCE_INLINE macro Index: adc_input.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/adc_input.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** adc_input.c 3 Jun 2003 23:51:29 -0000 1.5 --- adc_input.c 6 Jun 2003 17:28:30 -0000 1.6 *************** *** 4,10 **** #include <avr/io.h> - /* Not defined for the atMega163, but is for the atMega16 */ - #define ADHSM 4 - void adc_setup( void ) { --- 4,7 ---- *************** *** 63,67 **** #endif ! static inline void __attribute__ ((always_inline)) adc_get_sample( void ) { fixed16 sample; --- 60,64 ---- #endif ! FORCE_INLINE void adc_get_sample( void ) { fixed16 sample; *************** *** 103,107 **** /* Tune to the next channel */ ! pll_tune_next(); /* Reset the filters */ --- 100,104 ---- /* Tune to the next channel */ ! pll_tune_next(); /* Reset the filters */ |
From: <gjh...@us...> - 2003-06-06 17:33:24
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv11878 Modified Files: lcd_module.c Log Message: - changed to FORCE_INLINE macro Index: lcd_module.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/lcd_module.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** lcd_module.c 5 Jun 2003 20:43:10 -0000 1.8 --- lcd_module.c 6 Jun 2003 17:33:21 -0000 1.9 *************** *** 205,210 **** } ! static inline void __attribute__ ((always_inline)) ! lcd_write( unsigned char regSelect, unsigned char value ) { unsigned char reg, ddra, ddrb; --- 205,209 ---- } ! FORCE_INLINE lcd_write( unsigned char regSelect, unsigned char value ) { unsigned char reg, ddra, ddrb; *************** *** 272,277 **** } ! static inline unsigned char __attribute__ ((always_inline)) ! lcd_read( unsigned char regSelect ) { unsigned char value, ddra, ddrb; --- 271,275 ---- } ! FORCE_INLINE lcd_read( unsigned char regSelect ) { unsigned char value, ddra, ddrb; |
From: <gjh...@us...> - 2003-06-06 17:32:49
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv11637 Modified Files: iir_filter.c Log Message: - switched to FORCE_INLINE macro Index: iir_filter.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/iir_filter.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iir_filter.c 5 Mar 2003 05:42:51 -0000 1.7 --- iir_filter.c 6 Jun 2003 17:32:45 -0000 1.8 *************** *** 9,13 **** ! static inline fixed16 __attribute__ ((always_inline)) iir_filter( fixed16 sample, iir_params *filter ) { register unsigned char i; /* asm ("r3"); */ --- 9,13 ---- ! FORCE_INLINE fixed16 iir_filter( fixed16 sample, iir_params *filter ) { register unsigned char i; /* asm ("r3"); */ |
From: <gjh...@us...> - 2003-06-06 17:32:11
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv11303 Modified Files: i2c_bus.c Log Message: - switched outb usage to outp Index: i2c_bus.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/i2c_bus.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** i2c_bus.c 5 Jun 2003 18:08:59 -0000 1.5 --- i2c_bus.c 6 Jun 2003 17:32:08 -0000 1.6 *************** *** 28,32 **** /* Enable the I2C, make sure that the interrupt has been cleared */ ! outb( TWCR, 0x84 ); } --- 28,32 ---- /* Enable the I2C, make sure that the interrupt has been cleared */ ! outp( 0x84, TWCR ); } *************** *** 73,77 **** { /* Send the START condition */ ! outb( TWCR, 0xA5 ); /* The Interrupt handler will do the rest. Wait for the transfer to --- 73,77 ---- { /* Send the START condition */ ! outp( 0xA5, TWCR ); /* The Interrupt handler will do the rest. Wait for the transfer to *************** *** 93,97 **** } /* Send SLA+R/W */ ! outb( TWDR, i2c_slarw ); i2c_busy++; break; --- 93,97 ---- } /* Send SLA+R/W */ ! outp( i2c_slarw, TWDR ); i2c_busy++; break; *************** *** 103,107 **** } /* Send subaddr */ ! outb( TWDR, i2c_subaddr ); i2c_busy++; break; --- 103,107 ---- } /* Send subaddr */ ! outp( i2c_subaddr, TWDR ); i2c_busy++; break; *************** *** 120,124 **** i2c_length--; ! outb( TWDR, *i2c_data ); break; default: --- 120,124 ---- i2c_length--; ! outp( *i2c_data, TWDR ); break; default: *************** *** 133,137 **** error: /* Send STOP, Disable the I2C interrupt, and acknowledge the interrupt */ ! outb( TWCR, 0x94 ); i2c_busy = 0; } --- 133,137 ---- error: /* Send STOP, Disable the I2C interrupt, and acknowledge the interrupt */ ! outp( 0x94, TWCR ); i2c_busy = 0; } |
From: <gjh...@us...> - 2003-06-06 17:31:32
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv11020 Modified Files: detect_1kHz.c Log Message: - Fixed formatting - switched to FORCE_INLINE macro Index: detect_1kHz.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/detect_1kHz.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** detect_1kHz.c 2 Jun 2003 15:46:41 -0000 1.12 --- detect_1kHz.c 6 Jun 2003 17:31:28 -0000 1.13 *************** *** 19,23 **** iir_params __attribute__((progmem)) rom_iir_bpf_1000Hz = { 2, /* Output gain (number of shifts left) */ ! 10, /* Length = 10 (4 poles, 4 zeros) */ NULL, /* Coefficient Table */ NULL, /* Values Table (contains both x[n] and y[n]) */ --- 19,23 ---- iir_params __attribute__((progmem)) rom_iir_bpf_1000Hz = { 2, /* Output gain (number of shifts left) */ ! 10, /* Length = 10 (4 poles, 4 zeros) */ NULL, /* Coefficient Table */ NULL, /* Values Table (contains both x[n] and y[n]) */ *************** *** 77,81 **** initialize_average( &average_1000Hz ); ! /* Setup PD2 */ cbi( PORTD, 2 ); sbi( DDRD, 2 ); --- 77,81 ---- initialize_average( &average_1000Hz ); ! /* Setup PD2, is CD line, default to off */ cbi( PORTD, 2 ); sbi( DDRD, 2 ); *************** *** 88,96 **** /* PD2 is connected to the CD line on the RS232 port - this is used as a PPS ! * signal. May have to extend the pulse length for the 5ms bursts. * * Detect the 1kHz signal, drive PD2 high while detected, low when not detected */ ! static inline void do_1kHz_detection( fixed16 sample ) { filtered_1000Hz = iir_filter( sample, &iir_bpf_1000Hz ); --- 88,96 ---- /* PD2 is connected to the CD line on the RS232 port - this is used as a PPS ! * signal. May have to extend the pulse length for the 10ms bursts. * * Detect the 1kHz signal, drive PD2 high while detected, low when not detected */ ! FORCE_INLINE void do_1kHz_detection( fixed16 sample ) { filtered_1000Hz = iir_filter( sample, &iir_bpf_1000Hz ); |
From: <gjh...@us...> - 2003-06-06 17:18:36
|
Update of /cvsroot/snez-d/snez-d/software/include/avr In directory sc8-pr-cvs1:/tmp/cvs-serv5054 Modified Files: global.h Log Message: - made the FORCE_INLINE macro - changed the DETECT_COUNT to 8 seconds Index: global.h =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/include/avr/global.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** global.h 2 Jun 2003 15:46:40 -0000 1.15 --- global.h 6 Jun 2003 17:18:32 -0000 1.16 *************** *** 12,20 **** #define SAMPLE_RATE 8000 #define DETECT_PERIOD 8 ! #if 0 ! #define DETECT_COUNT (SAMPLE_RATE*DETECT_PERIOD) ! #else ! #define DETECT_COUNT 0xFFFF ! #endif #define REAL_DAC 1 --- 12,16 ---- #define SAMPLE_RATE 8000 #define DETECT_PERIOD 8 ! #define DETECT_COUNT (unsigned int)((unsigned int)SAMPLE_RATE* (unsigned int)DETECT_PERIOD) #define REAL_DAC 1 *************** *** 22,25 **** --- 18,23 ---- #define UART_TIMEOUT 500 + + #define FORCE_INLINE static inline __attribute__ ((always_inline)) extern unsigned int signal_detect_count; |
From: <gjh...@us...> - 2003-06-06 16:39:41
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv15782 Removed Files: fixed_point.c Log Message: - was empty for a while, no longer needed --- fixed_point.c DELETED --- |
From: <gjh...@us...> - 2003-06-05 20:43:16
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv32440 Modified Files: lcd_module.c Log Message: - expanded tabs to 4 spaces - changed the lcd_check_delay to use modulo 1000 math, and check for expiry by >= rather than == Index: lcd_module.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/lcd_module.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** lcd_module.c 5 Jun 2003 18:09:51 -0000 1.7 --- lcd_module.c 5 Jun 2003 20:43:10 -0000 1.8 *************** *** 136,153 **** endTick = lcdEndTick; asm volatile ( ! "clr %0" "\n\t" ! "L_%=a:" "\n\t" ! "lds %A2, msTimeTicks" "\n\t" ! "lds %B2, msTimeTicks+1" "\n\t" ! "lds %1, msTimeTicks+1" "\n\t" ! "cp %B2, %1" "\n\t" ! "brne L_%=a" "\n\t" ! "cp %B3, %B2" "\n\t" ! "brne L_%=a" "\n\t" ! "cp %A3, %A2" "\n\t" ! "brne L_%=b" "\n\t" ! "inc %0" "\n" ! "L_%=b:" "\n\t" : "=&r" (result), "=&r" (temp), "=&r" (now) : "r" (endTick) ); --- 136,185 ---- endTick = lcdEndTick; + /* msTimeTicks and lcdEndTick are modulo 1000. The max delay allowed is + * 499ms as all math must be modulo 1000. The algorithm used to detect + * an expiry is: + * A = end - now + 1000 + * = end - (now - 1000) + * if( A > 1000 ) B = 1500 + * else B = 500 + * + * if( A - B >= 0 ) expiry occurred + * + * In other words, if the amount of time left to delay is >= 500ms, then + * we must have had an expiry + * as: + * if( end > now ) expiry is when end - now >= 500 + * if( end < now ) expiry is when now - end >= 500 + * if( end = now ) expiry is true + */ asm volatile ( ! "clr %0" "\n\t" ! "L_%=a:" "\n\t" ! "lds %A2, msTimeTicks" "\n\t" ! "lds %B2, msTimeTicks+1" "\n\t" ! "lds %1, msTimeTicks+1" "\n\t" ! "cp %B2, %1" "\n\t" ! "brne L_%=a" "\n\t" ! "subi %A2, 0xE8" "\n\t" /* now - 1000 */ ! "sbci %B2, 0x03" "\n\t" ! "sub %A3, %A2" "\n\t" /* A = end - (now - 1000) */ ! "sbc %B3, %B2" "\n\t" ! "ldi %A2, 0xF4" "\n\t" /* B = 500 */ ! "ldi %B2, 0x01" "\n\t" ! "cpi %B3, 0x03" "\n\t" ! "brlo L_%=c" "\n\t" /* < 0x03xx, must be < 1000 */ ! "brne L_%=b" "\n\t" /* > 0x03xx, must be > 1000 */ ! "cpi %A3, 0xE8" "\n\t" ! "brlo L_%=c" "\n\t" /* < 0x03E8 (1000) */ ! "breq L_%=c" "\n\t" /* = 0x03E8 (1000) */ ! "L_%=b:" "\n\t" ! "ldi %A2, 0xDC" "\n\t" /* A > 1000, B = 1500 */ ! "ldi %B2, 0x05" "\n\t" ! "L_%=c:" "\n\t" ! "clr %0" "\n\t" /* result = 0x00 (expired) */ ! "sub %A3, %A2" "\n\t" /* A - B */ ! "sbc %B3, %B2" "\n\t" ! "sbci %0, 0" "\n\t" /* if answer -, result = 0xFF */ ! "com %0" "\n\t" /* result = ~result (0=not exp) */ : "=&r" (result), "=&r" (temp), "=&r" (now) : "r" (endTick) ); *************** *** 337,343 **** item = &lcdDisplayItem[lcdCurrentIndex]; ! /* Check if the buffer needs updating, if so call the formatting ! * routine for this location ! */ if( item->row == lcdCurrentRow && item->column == lcdCurrentColumn ) { --- 369,375 ---- item = &lcdDisplayItem[lcdCurrentIndex]; ! /* Check if the buffer needs updating, if so call the formatting ! * routine for this location ! */ if( item->row == lcdCurrentRow && item->column == lcdCurrentColumn ) { *************** *** 364,368 **** /* Send the data */ lcd_write_data( lcdBuf[lcdCurrentRow][lcdCurrentColumn] ); ! lcdBufChanged[lcdCurrentRow][lcdCurrentColumn] = 0; lcd_delay_setup( 1 ); lcdAddrData = 0; --- 396,400 ---- /* Send the data */ lcd_write_data( lcdBuf[lcdCurrentRow][lcdCurrentColumn] ); ! lcdBufChanged[lcdCurrentRow][lcdCurrentColumn] = 0; lcd_delay_setup( 1 ); lcdAddrData = 0; |
From: <gjh...@us...> - 2003-06-05 20:41:26
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv32023 Modified Files: timers.c Log Message: - expanded tabs to 4 spaces Index: timers.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/timers.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** timers.c 5 Jun 2003 18:08:11 -0000 1.8 --- timers.c 5 Jun 2003 20:41:23 -0000 1.9 *************** *** 25,67 **** void timer0_setup( void ) { ! unsigned char timsk; ! timeTickOverflow = 0; ! /* Generate a 1ms tick timer. This will be used for LCD delays, and ! * may be used for time of day ticks at some point too. ! * ! * As TIMER2 is an 8-bit timer, use a 64x prescaler off the 16MHz clock, ! * and then count 250 ticks of 4us each to get the 1ms delay. To ! * do this, you need to be in CTC mode. ! */ ! /* Disable Timer 0 interrupts */ ! timsk = inp( TIMSK ); ! timsk &= 0xFC; ! outp( timsk, TIMSK ); ! /* Set the counter's top first */ #if 0 ! outp( 250, OCR0 ); #endif ! outp( 62, OCR0 ); ! /* Set the output mode to CTC, disable the OC0, set to 64x prescale */ #if 0 ! outp( 0x0B, TCCR0 ); #endif ! outp( 0x0C, TCCR0 ); ! /* Clear the tick timer */ ! msTimeTicks = 0; ! usTimeAdj = 0; ! /* Clear the counter */ ! outp( 0, TCNT0 ); ! /* Enable the interrupt for output compare */ ! sbi( TIFR, OCIE0 ); ! sbi( TIMSK, OCF0 ); } --- 25,67 ---- void timer0_setup( void ) { ! unsigned char timsk; ! timeTickOverflow = 0; ! /* Generate a 1ms tick timer. This will be used for LCD delays, and ! * may be used for time of day ticks at some point too. ! * ! * As TIMER2 is an 8-bit timer, use a 64x prescaler off the 16MHz clock, ! * and then count 250 ticks of 4us each to get the 1ms delay. To ! * do this, you need to be in CTC mode. ! */ ! /* Disable Timer 0 interrupts */ ! timsk = inp( TIMSK ); ! timsk &= 0xFC; ! outp( timsk, TIMSK ); ! /* Set the counter's top first */ #if 0 ! outp( 250, OCR0 ); #endif ! outp( 62, OCR0 ); ! /* Set the output mode to CTC, disable the OC0, set to 64x prescale */ #if 0 ! outp( 0x0B, TCCR0 ); #endif ! outp( 0x0C, TCCR0 ); ! /* Clear the tick timer */ ! msTimeTicks = 0; ! usTimeAdj = 0; ! /* Clear the counter */ ! outp( 0, TCNT0 ); ! /* Enable the interrupt for output compare */ ! sbi( TIFR, OCIE0 ); ! sbi( TIMSK, OCF0 ); } *************** *** 76,131 **** { asm volatile ( ! "push r0" "\n\t" ! "push r24" "\n\t" ! "push r25" "\n\t" ! "push r26" "\n\t" ! "in r0, 0x3F" "\n\t" ! "ldi r26, 0xFF" "\n\t" ! "lds r24, usTimeAdj" "\n\t" ! "lds r25, usTimeAdj+1" "\n\t" ! "subi r24, %1" "\n\t" ! "sbci r25, %0" "\n\t" ! "cpi r25, 0x03" "\n\t" ! "brlo L_%=aa" "\n\t" ! "cpi r24, 0xE8" "\n\t" ! "brlo L_%=aa" "\n\t" ! "dec r26" "\n\t" ! "subi r24, 0xE8" "\n\t" ! "sbci r25, 0x03" "\n\t" ! "L_%=aa:" "\n\t" ! "sts usTimeAdj, r24" "\n\t" ! "sts usTimeAdj+1, r25" "\n\t" ! "lds r24, msTimeTicks" "\n\t" ! "lds r25, msTimeTicks+1" "\n\t" ! "sub r24, r26" "\n\t" ! "sbci r25, 0xFF" "\n\t" ! "cpi r25, 0x03" "\n\t" ! "brlo L_%=a" "\n\t" ! "cpi r24, 0xE8" "\n\t" ! "brlo L_%=a" "\n\t" ! "ldi r24, 1" "\n\t" ! "sts timeTickOverflow, r24" "\n\t" ! "clr r24" "\n\t" ! "clr r25" "\n\t" ! "L_%=a:" "\n\t" ! "sts msTimeTicks, r24" "\n\t" ! "sts msTimeTicks+1, r25" "\n\t" ! "lds r24, uartRxTimeout" "\n\t" ! "lds r25, uartRxTimeout+1" "\n\t" ! "mov r26, r24" "\n\t" ! "or r26, r25" "\n\t" ! "breq L_%=b" "\n\t" ! "subi r24, 1" "\n\t" ! "sbci r25, 0" "\n\t" ! "sts uartRxTimeout, r24" "\n\t" ! "sts uartRxTimeout+1, r25" "\n\t" ! "L_%=b:" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r26" "\n\t" ! "pop r25" "\n\t" ! "pop r24" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! : : "M" (US_TICK_ADJ_HI), "M" (US_TICK_ADJ_LO) ); } --- 76,131 ---- { asm volatile ( ! "push r0" "\n\t" ! "push r24" "\n\t" ! "push r25" "\n\t" ! "push r26" "\n\t" ! "in r0, 0x3F" "\n\t" ! "ldi r26, 0xFF" "\n\t" ! "lds r24, usTimeAdj" "\n\t" ! "lds r25, usTimeAdj+1" "\n\t" ! "subi r24, %1" "\n\t" ! "sbci r25, %0" "\n\t" ! "cpi r25, 0x03" "\n\t" ! "brlo L_%=aa" "\n\t" ! "cpi r24, 0xE8" "\n\t" ! "brlo L_%=aa" "\n\t" ! "dec r26" "\n\t" ! "subi r24, 0xE8" "\n\t" ! "sbci r25, 0x03" "\n\t" ! "L_%=aa:" "\n\t" ! "sts usTimeAdj, r24" "\n\t" ! "sts usTimeAdj+1, r25" "\n\t" ! "lds r24, msTimeTicks" "\n\t" ! "lds r25, msTimeTicks+1" "\n\t" ! "sub r24, r26" "\n\t" ! "sbci r25, 0xFF" "\n\t" ! "cpi r25, 0x03" "\n\t" ! "brlo L_%=a" "\n\t" ! "cpi r24, 0xE8" "\n\t" ! "brlo L_%=a" "\n\t" ! "ldi r24, 1" "\n\t" ! "sts timeTickOverflow, r24" "\n\t" ! "clr r24" "\n\t" ! "clr r25" "\n\t" ! "L_%=a:" "\n\t" ! "sts msTimeTicks, r24" "\n\t" ! "sts msTimeTicks+1, r25" "\n\t" ! "lds r24, uartRxTimeout" "\n\t" ! "lds r25, uartRxTimeout+1" "\n\t" ! "mov r26, r24" "\n\t" ! "or r26, r25" "\n\t" ! "breq L_%=b" "\n\t" ! "subi r24, 1" "\n\t" ! "sbci r25, 0" "\n\t" ! "sts uartRxTimeout, r24" "\n\t" ! "sts uartRxTimeout+1, r25" "\n\t" ! "L_%=b:" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r26" "\n\t" ! "pop r25" "\n\t" ! "pop r24" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! : : "M" (US_TICK_ADJ_HI), "M" (US_TICK_ADJ_LO) ); } *************** *** 133,173 **** void timer1_setup( void ) { ! unsigned char timsk; ! /* Generate a PWM signal to control the LCD's contrast. The contrast ! * control requires a voltage between 0V and 5V, so create a PWM ! * signal with 5V amplitude, then pass it through an LPF (read ! * capacitor with bleed resistor) to make it a DC voltage proportional ! * to the 8-bit value given ! * ! * Run the signal at around 8kHz, using Fast PWM mode (single slope) on ! * OC1A (PD5) ! */ ! /* Disable Timer 1 interrupts */ ! timsk = inp( TIMSK ); ! timsk &= 0xC3; ! outp( timsk, TIMSK ); ! /* Set the output mode to 8-bit Fast PWM for OC1A, disable OC1B, set ! * OC1A to clear the pin on compare match */ ! outp( 0x81, TCCR1A ); ! /* Set the prescaler to 8 (counter ticks at 2MHz), disable ICP1 */ ! outp( 0x0A, TCCR1B ); ! /* Set the initial value */ ! lcd_contrast = 128; ! /* Set the value of the compare */ ! outp( 0, OCR1AH ); ! outp( lcd_contrast, OCR1AL ); ! /* Set the PWM pin (OC1A/PD5) as an output */ ! sbi( DDRB, 5 ); ! /* Enable the interrupt for overflow */ ! outp( (timsk | BV(TOIE1)), TIMSK ); } --- 133,173 ---- void timer1_setup( void ) { ! unsigned char timsk; ! /* Generate a PWM signal to control the LCD's contrast. The contrast ! * control requires a voltage between 0V and 5V, so create a PWM ! * signal with 5V amplitude, then pass it through an LPF (read ! * capacitor with bleed resistor) to make it a DC voltage proportional ! * to the 8-bit value given ! * ! * Run the signal at around 8kHz, using Fast PWM mode (single slope) on ! * OC1A (PD5) ! */ ! /* Disable Timer 1 interrupts */ ! timsk = inp( TIMSK ); ! timsk &= 0xC3; ! outp( timsk, TIMSK ); ! /* Set the output mode to 8-bit Fast PWM for OC1A, disable OC1B, set ! * OC1A to clear the pin on compare match */ ! outp( 0x81, TCCR1A ); ! /* Set the prescaler to 8 (counter ticks at 2MHz), disable ICP1 */ ! outp( 0x0A, TCCR1B ); ! /* Set the initial value */ ! lcd_contrast = 128; ! /* Set the value of the compare */ ! outp( 0, OCR1AH ); ! outp( lcd_contrast, OCR1AL ); ! /* Set the PWM pin (OC1A/PD5) as an output */ ! sbi( DDRB, 5 ); ! /* Enable the interrupt for overflow */ ! outp( (timsk | BV(TOIE1)), TIMSK ); } *************** *** 181,196 **** { asm volatile ( ! "push r0" "\n\t" ! "push r1" "\n\t" ! "in r0, 0x3F" "\n\t" ! "clr r1" "\n\t" ! "out 0x2B, r1" "\n\t" ! "lds r1, lcd_contrast" "\n\t" ! "out 0x2A, r1" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r1" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! : ); } --- 181,196 ---- { asm volatile ( ! "push r0" "\n\t" ! "push r1" "\n\t" ! "in r0, 0x3F" "\n\t" ! "clr r1" "\n\t" ! "out 0x2B, r1" "\n\t" ! "lds r1, lcd_contrast" "\n\t" ! "out 0x2A, r1" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r1" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! : ); } *************** *** 199,234 **** void timer2_setup( void ) { ! unsigned char timsk; ! /* This needs to be 8000Hz to trigger the A/D readings. As TIMER2 is ! * an 8-bit timer, we need to use the 8x prescaler off the 16MHz clock, ! * and then count 250 ticks of 500ns each to get the 125us delay. To ! * do this, you need to be in CTC mode. ! */ ! /* Make sure it's disabled, as well as the interrupts */ ! timsk = inp( TIMSK ); ! timsk &= 0x3F; ! outp( timsk, TIMSK ); ! outp( 0, TCCR2 ); ! /* Set the counter's top first */ ! outp( 250, OCR2 ); ! /* Set it into synchronous mode, using 16MHz clock */ ! outp( 0, ASSR ); ! /* Reset the prescaler */ ! sbi( SFIOR, PSR2 ); ! /* Clear the counter */ ! outp( 0, TCNT2 ); ! /* Clear the interrupt, then enable it */ ! sbi( TIFR, OCF2 ); ! outp( (timsk | BV(OCIE2)), TIMSK ); ! /* Enable the timer in CTC mode, prescaler of 8 */ ! outp( 0x0A, TCCR2 ); } --- 199,234 ---- void timer2_setup( void ) { ! unsigned char timsk; ! /* This needs to be 8000Hz to trigger the A/D readings. As TIMER2 is ! * an 8-bit timer, we need to use the 8x prescaler off the 16MHz clock, ! * and then count 250 ticks of 500ns each to get the 125us delay. To ! * do this, you need to be in CTC mode. ! */ ! /* Make sure it's disabled, as well as the interrupts */ ! timsk = inp( TIMSK ); ! timsk &= 0x3F; ! outp( timsk, TIMSK ); ! outp( 0, TCCR2 ); ! /* Set the counter's top first */ ! outp( 250, OCR2 ); ! /* Set it into synchronous mode, using 16MHz clock */ ! outp( 0, ASSR ); ! /* Reset the prescaler */ ! sbi( SFIOR, PSR2 ); ! /* Clear the counter */ ! outp( 0, TCNT2 ); ! /* Clear the interrupt, then enable it */ ! sbi( TIFR, OCF2 ); ! outp( (timsk | BV(OCIE2)), TIMSK ); ! /* Enable the timer in CTC mode, prescaler of 8 */ ! outp( 0x0A, TCCR2 ); } *************** *** 243,259 **** { asm volatile ( ! "push r0" "\n\t" ! "push r1" "\n\t" ! "in r0, 0x3F" "\n\t" ! "lds r1, adc_enabled" "\n\t" ! "and r1, r1" "\n\t" ! "breq L_%=a" "\n\t" ! "sbi 0x06, 5" "\n\t" ! "L_%=a:" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r1" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! : ); } --- 243,259 ---- { asm volatile ( ! "push r0" "\n\t" ! "push r1" "\n\t" ! "in r0, 0x3F" "\n\t" ! "lds r1, adc_enabled" "\n\t" ! "and r1, r1" "\n\t" ! "breq L_%=a" "\n\t" ! "sbi 0x06, 5" "\n\t" ! "L_%=a:" "\n\t" ! "out 0x3F, r0" "\n\t" ! "pop r1" "\n\t" ! "pop r0" "\n\t" ! "reti" "\n\t" ! : ); } |
From: <gjh...@us...> - 2003-06-05 18:09:54
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv16714 Modified Files: lcd_module.c Log Message: - fixed the lcd_delay inline assembly Index: lcd_module.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/lcd_module.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** lcd_module.c 30 May 2003 20:55:29 -0000 1.6 --- lcd_module.c 5 Jun 2003 18:09:51 -0000 1.7 *************** *** 139,154 **** "clr %0" "\n\t" "L_%=a:" "\n\t" ! "lds %A1, msTimeTicks" "\n\t" ! "lds %B1, msTimeTicks+1" "\n\t" ! "lds %3, msTimeTicks+1" "\n\t" ! "cp %B1, %2" "\n\t" "brne L_%=a" "\n\t" ! "cp %B2, %B1" "\n\t" "brne L_%=a" "\n\t" ! "cp %A2, %A1" "\n\t" "brne L_%=b" "\n\t" "inc %0" "\n" "L_%=b:" "\n\t" ! : "=&r" (result) : "r" (now), "r" (endTick), "r" (temp) ); --- 139,154 ---- "clr %0" "\n\t" "L_%=a:" "\n\t" ! "lds %A2, msTimeTicks" "\n\t" ! "lds %B2, msTimeTicks+1" "\n\t" ! "lds %1, msTimeTicks+1" "\n\t" ! "cp %B2, %1" "\n\t" "brne L_%=a" "\n\t" ! "cp %B3, %B2" "\n\t" "brne L_%=a" "\n\t" ! "cp %A3, %A2" "\n\t" "brne L_%=b" "\n\t" "inc %0" "\n" "L_%=b:" "\n\t" ! : "=&r" (result), "=&r" (temp), "=&r" (now) : "r" (endTick) ); *************** *** 364,367 **** --- 364,368 ---- /* Send the data */ lcd_write_data( lcdBuf[lcdCurrentRow][lcdCurrentColumn] ); + lcdBufChanged[lcdCurrentRow][lcdCurrentColumn] = 0; lcd_delay_setup( 1 ); lcdAddrData = 0; |
From: <gjh...@us...> - 2003-06-05 18:09:03
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv16381 Modified Files: i2c_bus.c Log Message: - made i2c_busy a volatile to fix the wait-looping Index: i2c_bus.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/i2c_bus.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** i2c_bus.c 29 May 2003 04:46:46 -0000 1.4 --- i2c_bus.c 5 Jun 2003 18:08:59 -0000 1.5 *************** *** 11,15 **** #define I2C_READ 0x01 ! unsigned char i2c_busy; unsigned char *i2c_data; unsigned char i2c_slarw; --- 11,15 ---- #define I2C_READ 0x01 ! volatile unsigned char i2c_busy; unsigned char *i2c_data; unsigned char i2c_slarw; |
From: <gjh...@us...> - 2003-06-05 18:08:14
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv15586 Modified Files: timers.c Log Message: - changed to calculate a tickAdj value that will adjust for the amount of time spent in the handler - changed timer0 to use a /256 prescaler, count to 62. The /64, count to 250 didn't work with AVR Studio 4.07 Index: timers.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/timers.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** timers.c 30 May 2003 21:43:13 -0000 1.7 --- timers.c 5 Jun 2003 18:08:11 -0000 1.8 *************** *** 8,13 **** --- 8,19 ---- unsigned int msTimeTicks; + unsigned int usTimeAdj; unsigned char timeTickOverflow; + #define US_TICK_ADJ 8 + #define US_TICK_ADJ_NEG ((~US_TICK_ADJ) + 1) + #define US_TICK_ADJ_HI ((US_TICK_ADJ_NEG & 0xFF00) >> 8) + #define US_TICK_ADJ_LO (US_TICK_ADJ_NEG & 0x00FF) + /* Timer use: * *************** *** 37,47 **** --- 43,60 ---- /* Set the counter's top first */ + #if 0 outp( 250, OCR0 ); + #endif + outp( 62, OCR0 ); /* Set the output mode to CTC, disable the OC0, set to 64x prescale */ + #if 0 outp( 0x0B, TCCR0 ); + #endif + outp( 0x0C, TCCR0 ); /* Clear the tick timer */ msTimeTicks = 0; + usTimeAdj = 0; /* Clear the counter */ *************** *** 68,74 **** "push r26" "\n\t" "in r0, 0x3F" "\n\t" "lds r24, msTimeTicks" "\n\t" "lds r25, msTimeTicks+1" "\n\t" ! "adiw r24, 1" "\n\t" "cpi r25, 0x03" "\n\t" "brlo L_%=a" "\n\t" --- 81,103 ---- "push r26" "\n\t" "in r0, 0x3F" "\n\t" + "ldi r26, 0xFF" "\n\t" + "lds r24, usTimeAdj" "\n\t" + "lds r25, usTimeAdj+1" "\n\t" + "subi r24, %1" "\n\t" + "sbci r25, %0" "\n\t" + "cpi r25, 0x03" "\n\t" + "brlo L_%=aa" "\n\t" + "cpi r24, 0xE8" "\n\t" + "brlo L_%=aa" "\n\t" + "dec r26" "\n\t" + "subi r24, 0xE8" "\n\t" + "sbci r25, 0x03" "\n\t" + "L_%=aa:" "\n\t" + "sts usTimeAdj, r24" "\n\t" + "sts usTimeAdj+1, r25" "\n\t" "lds r24, msTimeTicks" "\n\t" "lds r25, msTimeTicks+1" "\n\t" ! "sub r24, r26" "\n\t" ! "sbci r25, 0xFF" "\n\t" "cpi r25, 0x03" "\n\t" "brlo L_%=a" "\n\t" *************** *** 98,102 **** "pop r0" "\n\t" "reti" "\n\t" ! : ); } --- 127,131 ---- "pop r0" "\n\t" "reti" "\n\t" ! : : "M" (US_TICK_ADJ_HI), "M" (US_TICK_ADJ_LO) ); } |
From: <gjh...@us...> - 2003-06-05 18:06:16
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv15139 Modified Files: Makefile Log Message: - Fixed the COFF output to adjust the sections properly Index: Makefile =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/Makefile,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Makefile 4 Jun 2003 18:34:49 -0000 1.19 --- Makefile 5 Jun 2003 18:06:11 -0000 1.20 *************** *** 12,16 **** OPTFLAGS = -O3 CFLAGS = -g -mmcu=${CPU} ${OPTFLAGS} ${INCLUDES} ${EXTRA} ${REGISTERS} ! LDFLAGS = -Wl,-Map,${MAPFILE} OBJS = main.o adc_input.o fixed_point.o bell103_modem.o \ --- 12,16 ---- OPTFLAGS = -O3 CFLAGS = -g -mmcu=${CPU} ${OPTFLAGS} ${INCLUDES} ${EXTRA} ${REGISTERS} ! LDFLAGS = -g -Wl,-Map,${MAPFILE} OBJS = main.o adc_input.o fixed_point.o bell103_modem.o \ *************** *** 20,28 **** MAPFILE = snez-d.map ELF_TARGET = snez-d.elf ! COFF_TARGET = snez-d.coff LISTFILE = snez-d.dis HEXFILE = snez-d.hex ! .SUFFIXES: .dis .elf .c .o .hex .coff all: ${ELF_TARGET} ${LISTFILE} ${HEXFILE} ${COFF_TARGET} --- 20,28 ---- MAPFILE = snez-d.map ELF_TARGET = snez-d.elf ! COFF_TARGET = snez-d.cof LISTFILE = snez-d.dis HEXFILE = snez-d.hex ! .SUFFIXES: .dis .elf .c .o .hex .cof all: ${ELF_TARGET} ${LISTFILE} ${HEXFILE} ${COFF_TARGET} *************** *** 50,54 **** ${OBJCOPY} -O ihex $+ $@ ! .elf.coff: ! ${OBJCOPY} -O coff-ext-avr $+ $@ --- 50,58 ---- ${OBJCOPY} -O ihex $+ $@ ! .elf.cof: ! ${OBJCOPY} --debugging -O coff-ext-avr \ ! --change-section-address .data-0x800000 \ ! --change-section-address .bss-0x800000 \ ! --change-section-address .noinit-0x800000 \ ! --change-section-address .eeprom-0x810000 $+ $@ |
From: <gjh...@us...> - 2003-06-04 18:34:53
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv315 Modified Files: Makefile Log Message: - added .coff output for use with AVR Studio 4. Requires v2.0 of toolset Index: Makefile =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/Makefile,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Makefile 2 Jun 2003 15:46:41 -0000 1.18 --- Makefile 4 Jun 2003 18:34:49 -0000 1.19 *************** *** 20,29 **** MAPFILE = snez-d.map ELF_TARGET = snez-d.elf LISTFILE = snez-d.dis HEXFILE = snez-d.hex ! .SUFFIXES: .dis .elf .c .o .hex ! all: ${ELF_TARGET} ${LISTFILE} ${HEXFILE} ${SIZE} ${ELF_TARGET} --- 20,30 ---- MAPFILE = snez-d.map ELF_TARGET = snez-d.elf + COFF_TARGET = snez-d.coff LISTFILE = snez-d.dis HEXFILE = snez-d.hex ! .SUFFIXES: .dis .elf .c .o .hex .coff ! all: ${ELF_TARGET} ${LISTFILE} ${HEXFILE} ${COFF_TARGET} ${SIZE} ${ELF_TARGET} *************** *** 32,36 **** clean: ! -${RM} ${OBJS} ${ELF_TARGET} ${MAPFILE} ${LISTFILE} ${HEXFILE} main.o: main.c adc_input.c iir_filter.c dac_output.c average.c --- 33,38 ---- clean: ! -${RM} ${OBJS} ${ELF_TARGET} ${MAPFILE} ${LISTFILE} ${HEXFILE} ! -${RM} ${COFF_TARGET} main.o: main.c adc_input.c iir_filter.c dac_output.c average.c *************** *** 43,49 **** .o.dis: ! ${OBJDUMP} -S -x -s -z $+ > $@ .elf.hex: ${OBJCOPY} -O ihex $+ $@ --- 45,54 ---- .o.dis: ! ${OBJDUMP} -S -x -s -z $+ > $@ .elf.hex: ${OBJCOPY} -O ihex $+ $@ + + .elf.coff: + ${OBJCOPY} -O coff-ext-avr $+ $@ |
From: <gjh...@us...> - 2003-06-03 23:51:32
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv18311/src/avr Modified Files: adc_input.c pll_control.c Log Message: - Added in the PLL retuning & tuning Index: adc_input.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/adc_input.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** adc_input.c 3 Jun 2003 22:44:36 -0000 1.4 --- adc_input.c 3 Jun 2003 23:51:29 -0000 1.5 *************** *** 103,107 **** /* Tune to the next channel */ ! /* Reset the filters */ --- 103,107 ---- /* Tune to the next channel */ ! pll_tune_next(); /* Reset the filters */ Index: pll_control.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/pll_control.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pll_control.c 30 May 2003 20:37:05 -0000 1.7 --- pll_control.c 3 Jun 2003 23:51:29 -0000 1.8 *************** *** 11,14 **** --- 11,17 ---- #define PLL_ADDRESS 0x55 + #define PLL_FIRST_INDEX 0 /* CHU's start frequency */ + #define PLL_LAST_INDEX 2 /* CHU's last frequency */ + typedef struct { unsigned char clk_div; *************** *** 63,69 **** /* Setup the I/O for S2 */ pll_current_S2 = 0xFF; - pll_current_LO_index = 0; cbi( PORTC, 7 ); /* Drive low, no pullup */ drive_lo_select(); } --- 66,77 ---- /* Setup the I/O for S2 */ pll_current_S2 = 0xFF; cbi( PORTC, 7 ); /* Drive low, no pullup */ drive_lo_select(); + + /* Set the first LO */ + pll_tune_first(); + + /* Set the second LO (which never changes) */ + pll_second_lo_set(); } *************** *** 123,124 **** --- 131,147 ---- } + + void pll_tune_first( void ) + { + pll_current_LO_index = PLL_FIRST_INDEX; + pll_first_lo_set( pll_current_LO_index ); + } + + void pll_tune_next( void ) + { + pll_current_LO_index++; + if( pll_current_LO_index > PLL_LAST_INDEX ) { + pll_current_LO_index = PLL_FIRST_INDEX; + } + pll_first_lo_set( pll_current_LO_index ); + } |
From: <gjh...@us...> - 2003-06-03 23:51:32
|
Update of /cvsroot/snez-d/snez-d/software/include/avr In directory sc8-pr-cvs1:/tmp/cvs-serv18311/include/avr Modified Files: protos.h Log Message: - Added in the PLL retuning & tuning Index: protos.h =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/include/avr/protos.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** protos.h 2 Jun 2003 15:46:40 -0000 1.21 --- protos.h 3 Jun 2003 23:51:29 -0000 1.22 *************** *** 32,35 **** --- 32,37 ---- void pllDisplayFrequency( unsigned char *buffer, unsigned char *changed, unsigned char length ); + void pll_tune_first( void ); + void pll_tune_next( void ); /* In i2c_bus.c */ |
From: <gjh...@us...> - 2003-06-03 22:44:39
|
Update of /cvsroot/snez-d/snez-d/software/src/avr In directory sc8-pr-cvs1:/tmp/cvs-serv25695 Modified Files: adc_input.c Log Message: - test Index: adc_input.c =================================================================== RCS file: /cvsroot/snez-d/snez-d/software/src/avr/adc_input.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** adc_input.c 2 Jun 2003 15:46:41 -0000 1.3 --- adc_input.c 3 Jun 2003 22:44:36 -0000 1.4 *************** *** 104,107 **** --- 104,108 ---- /* Tune to the next channel */ + /* Reset the filters */ initialize_average( &average_1000Hz ); |