ts-7000
[Top] [All Lists]

[ts-7000] Re: TS7250 DIO

To:
Subject: [ts-7000] Re: TS7250 DIO
From: "kevin_at_newport" <>
Date: Mon, 21 Nov 2011 15:07:06 -0000
I agree with Jim -- probably the compiler's optimized out the write to hardware 
because it didn't look like it did anything useful.  "volatile" is the best way 
to fix that. It tells the compiler to always reload/reaccess the memory 
location.  Your C language variables are, ultimately, stored in one or more CPU 
registers.  "volatile" assures that those registers are reloaded every time.

"printf()" probably worked because of all the work that goes on under the hood 
-- the compiler knew that the CPU registers couldn't be counted on to have the 
same contents and would, therefore, reload them.

Kevin

--- In  Jim Jackson <> wrote:
>
> 
> 
> 
> On Mon, 21 Nov 2011, thoff88 wrote:
> 
> > I am fairly new to the ts7250 and I'm trying to control the DIO pins. 
> > When I toggle the pins in a for loop nothing happens unless there is a 
> > printf() statement within the loop. I am using rtai functions so I can 
> > use the real time timer between the loop iterations, yet the pins still 
> > only toggle when there is a printf() statement in the loop.
> > 
> > If anyone has suggestions to what may be causing this it would be very 
> > appreciated.
> 
> Without code it's like being mystic meg :-)
> But probably because you haven't declared your pointers as volatile.
> Or not using the correct options in mmap? e.g.
> 
> volatile unsigned char * ptr = mmap(0,getpagesize(),PROT_READ|PROT_WRITE, \
>          MAP_SHARED,fd,address)
>




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU