embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

What the hey !.... ATMEGA103

From: Gene Silvernail <genes_at_belhaven.com>
Date: Thu, 19 Sep 2002 19:31:46 -0700

            
 
What is going on....
 
The following data comes from an AD, (24 bit) that is used to read IR. I
get different results depending upon whether the compiled word WWW is
Executed verses the words that are making up WWW. All this is done from
the XTL console. Why should running the compiled word WWW make any
difference versus the running the words that are used to compile WWW.
The following are copies from XTL and my editor.
 
Something gotta be nailing the body of the compiled code.TIB ??
 
Any suggestions on how to trouble shoot this would be appreciated.
 
 
 
 
 
 
: PICK-CHANNEL ( n-- ) \ Enter with
CH1...CH8, or NO-CHAN
        SPI-ON
        LTC2408-SPI-MODE
        2408-DESELECT \ Must leave
CS on LTC2408 must be HI
        SPDR C!
         ;
 
 
{
========================================================================
=
 
  GET-DATA stores the 4 bytes from the LTC2408, storing at
 
  2408-DATA bits 31-24 offset 1
  2408-DATA+1 bits 23-16 offset 0
  2408-DATA+2 bits 15-8 offset 3
  2408-DATA+3 bits 7-0 offset 2
 
  This is correct for 2@, 2!
========================================================================
= }
 
 
 
: GET-DATA ( n -- )
            PICK-CHANNEL
            BEGIN AD-DONE? UNTIL
            0 SPDR C! ?SPI-DONE SPDR C@ 1 2408-DATA + C!
            0 SPDR C! ?SPI-DONE SPDR C@ 2408-DATA C!
            0 SPDR C! ?SPI-DONE SPDR C@ 3 2408-DATA + C!
            0 SPDR C! ?SPI-DONE SPDR C@ 2 2408-DATA + C!
            2408-DATA 2@ D2/ D2/ D2/ D2/
            2408-DATA 2!
            0 2408-DATA 1+ C!
            SPI-OFF
            ;
 
 
: IR-ON ( -- )
            IR-CONTROL PORTD SET-BIT
         ;
 
 
: IR-OFF ( -- )
            IR-CONTROL PORTD CLEAR-BIT
         ;
 
 
: WWW ( -- )
 
            IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. ;
 
Compiled WWW code
 
 
3106 IR-ON RCALL 3AD8
3108 (LITERAL) CALL 0E943000
310C LITERAL D
310E 100MS RCALL BBD8
3110 (LITERAL) CALL 0E943000
3114 LITERAL 8
3116 GET-DATA RCALL F7DE
3118 (LITERAL) CALL 0E943000
311C LITERAL 8FF
311E 2@ CALL 0E944F02
3122 IR-OFF RCALL 33D8
3124 D. JMP 0C947506 ok
 
 
 
 
 
HERE IS A TYPICAL SESSION....
 
 
 
 
READCOLD 5372 ok
READCOLD 5788 ok
READCOLD 5954 ok
READCOLD 5718 ok
 
 
Now we turn the IR source on..climbing values are to expected
 
 
WWW 350322 ok
WWW 359556 ok
WWW 367106 ok
WWW 372434 ok
 
 
Here are the words direct..big difference.. eh
 
IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. 485175 ok
IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. 493667 ok
IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. 503249 ok
IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. 509294 ok
 
 
Repeating WWW
 
WWW 347811 ok
WWW 353093 ok
WWW 361707 ok
WWW 368330 ok
 
 
Repeating words direct..
 
 
IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. 487014 ok
IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. 497636 ok
IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. 506249 ok
IR-ON 13 100MS CH1 GET-DATA 2408-DATA 2@ IR-OFF D. 513419 ok
 
Redoing WWW to this was no help..forced an output value
 
Also forced an output value from within GET-DATA..worked fine
 
: WWW
 
            IR-ON 13 100MS CH1 GET-DATA
            { 2408-DATA 2@ }
            1234567.
            IR-OFF D.
             ;
 
 
IR-ON 13 100MS CH1 GET-DATA 1234567. IR-OFF D. 1234567 ok
IR-ON 13 100MS CH1 GET-DATA 1234567. IR-OFF D. 1234567 ok
WWW 1234567 ok
WWW 1234567 ok
WWW 1234567 ok
IR-ON 13 100MS CH1 GET-DATA 1234567. IR-OFF D. 1234567 ok
IR-ON 13 100MS CH1 GET-DATA 1234567. IR-OFF D. 1234567 ok

----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Thu Sep 19 2002 - 19:31:50 PDT

This archive was generated by hypermail 2.2.0 : Fri Dec 05 2008 - 03:04:21 PST