ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: 7260 SPI & MAX6675

To:
Subject: Re: [ts-7000] Re: 7260 SPI & MAX6675
From: Jim Jackson <>
Date: Wed, 3 Nov 2010 09:20:35 +0000 (GMT)
Ok I've snipped stuff out. Also have you tested that you are actually 
addressing the DIO interface? Have you hooked up wires from 3.3v and ground 
to various DIO pins and then checked that your read code actually gets 
the right values?

Comments below...

On Wed, 3 Nov 2010, yavin229 wrote:

> 
> #define SSPCR0   0x808a0000
> #define base    0x808a0000
> 
> int fd,diobits,diobits_post_change, dio_direction_bits, 
>         dio_direction_bits_post_change;
> 
> int main ()
> {
> volatile unsigned long int *memloc;
> 
> fd = open("/dev/mem", O_RDWR|O_SYNC);
> 
> if (fd == -1){
>         perror("open(/dev/mem):");
>         return 0;
> }
> 
> memloc = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, MEMLOC);
>         assert(memloc != MAP_FAILED);
> 
> diobits = PEEK8( (unsigned long)(memloc + 0x04));

You are adding 4 to an int pointer. The compiler knows this is an int and 
assumes you want the 4th int after so in bytes, this is the same as
memloc+16. At this address is the LCD interface byte ddr register.

Either make your pointer an unsigned char * so that offsets are in bytes, 
you are accessing a single byte anyway, or use memloc+1 here.

You can check this by printing the addresses using a printf to double 
check.

Jim


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

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