diff options
author | Christian Pointner <equinox@mur.at> | 2012-07-05 03:45:33 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2012-07-05 03:45:33 +0000 |
commit | 0066cb2480b4f3e5541d369d8bac4f50a4c22fe5 (patch) | |
tree | 1115a886105a47292733e1d099504738dd42789d | |
parent | ssp test works (diff) |
cleanup
git-svn-id: https://svn.spreadspace.org/mur.sat@577 7de4ea59-55d0-425e-a1af-a3118ea81d4c
-rw-r--r-- | software/idm-test/idm-test.c | 11 | ||||
-rw-r--r-- | software/idm/idm.asm | 44 |
2 files changed, 24 insertions, 31 deletions
diff --git a/software/idm-test/idm-test.c b/software/idm-test/idm-test.c index a4c4535..9e10771 100644 --- a/software/idm-test/idm-test.c +++ b/software/idm-test/idm-test.c @@ -106,7 +106,7 @@ void SetupHardware(void) TCCR0B = (1 << CS02);
- SPI_Init(SPI_SPEED_FCPU_DIV_64 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST |
+ SPI_Init(SPI_SPEED_FCPU_DIV_8 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST |
SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING);
SPI_CS_DDR |= (1<<CS);
SPI_CS_PORT |= (1<<CS);
@@ -157,12 +157,15 @@ void IDM_ReadData(void) RingBuffer_Insert(&SPItoUSB_Buffer, ReceivedByte);
tmp_cnt++;
- if(RingBuffer_IsFull(&SPItoUSB_Buffer))
+ /* if(RingBuffer_IsFull(&SPItoUSB_Buffer)) */
+ if(RingBuffer_GetFreeCount(&SPItoUSB_Buffer) == 1)
break;
- _delay_us(50);
+ _delay_us(70);
int_state = (INT_PIN & (1<<INT));
}
-
+
+ RingBuffer_Insert(&SPItoUSB_Buffer, 128);
+
_delay_us(30);
SPI_CS_PORT |= (1<<CS);
_delay_us(50);
diff --git a/software/idm/idm.asm b/software/idm/idm.asm index d779b4b..5883dcb 100644 --- a/software/idm/idm.asm +++ b/software/idm/idm.asm @@ -35,8 +35,11 @@ ;; constants BUF_STARTH EQU H'0020' BUF_STARTL EQU H'0000' -BUF_ENDH EQU H'0023' -BUF_ENDL EQU H'00BF' +BUF_ENDH EQU H'0020' +BUF_ENDL EQU H'0060' +;; BUF_ENDH EQU H'0023' +;; BUF_ENDL EQU H'00BF' + #define FSRW FSR0 #define FSRWH FSR0H #define FSRWL FSR0L @@ -138,8 +141,6 @@ endif ;; } int_adc bcf PIR1,ADIF - retfie - btfsc OVERRUN retfie ;; movlb .1 @@ -147,6 +148,8 @@ int_adc movf TMP,w movwf INDFW incf TMP,f + btfsc TMP,7 + clrf TMP movlb .0 call wbuf_next bcf INT @@ -184,13 +187,6 @@ int_spi int_spi_0 btfss CMD_READ retfie - - incf TMP,f - movlb .4 - movf TMP,w - movwf SSP1BUF - retfie - movlb .0 call rbuf_next btfss UNDERRUN @@ -205,9 +201,8 @@ int_spi_0_loadnext goto int_fsr_norestore int_spi_r - ;; movf INDFR,w - ;; btfss UNDERRUN - movf TMP,w + movf INDFR,w + btfss UNDERRUN movwf SSP1BUF clrf CMDS bsf CMD_READ @@ -361,8 +356,7 @@ endif movwf ADCON1 movlw b'00001101' ; AN3, ADC On movwf ADCON0 - ;; movlw b'01001000' ; ADIE,SSPIE - movlw b'00001000' ; SSPIE + movlw b'01001000' ; ADIE,SSPIE movwf PIE1 movlw b'01011111' ; Enable Pull UPs, disable T0CKI movwf OPTION_REG @@ -393,19 +387,15 @@ main if DEBUG == 1 bcf SPEAKER btfss DBG0 - bcf INT - btfsc DBG0 - bsf INT + goto enable_t1 -;; goto enable_t1 - -;; btfsc T1CON,TMR1ON -;; bcf T1CON,TMR1ON -;; goto main + btfsc T1CON,TMR1ON + bcf T1CON,TMR1ON + goto main -;; enable_t1 -;; btfss T1CON,TMR1ON -;; bsf T1CON,TMR1ON +enable_t1 + btfss T1CON,TMR1ON + bsf T1CON,TMR1ON endif btfss CS goto main |