To: | |
---|---|
Subject: | Re: [ts-7000] TS-7300, DIO & Keypa |
From: | "Don W. Carr" <> |
Date: | Sun, 12 Nov 2006 19:12:08 -0600 |
I don't thing the attachments work, so I will paste it in directly. This program has two modes, as either inputs or outputs. In the output mode, it flashes the outputs on and off every second. Don. #include<stdio.h > #include<string.h> #include<unistd.h> #include<sys/types.h> #include<sys/mman.h> #include<sys/time.h> #include<fcntl.h> volatile unsigned char *ddir, *data; struct timeval repeat_time; int main(int argc, char *argv[]) { unsigned char *start; int fd = open("/dev/mem", O_RDWR|O_SYNC); start = (unsigned char *) mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x80840000); data = "" char *)(start + 0x4); ddir = (unsigned char *)(start + 0x14); if (argc > 1) { printf("Outputs\n"); *ddir = 0xFF; while (true) { *data = "" usleep(500000); *data = ""> usleep(500000); } } else { printf("Inputs\n"); *ddir = 0x00; while (true) { unsigned int val, mask; val = *data; printf("%02x ", val); for (int i=0; i < 8; i++) { mask = 0x1 << i; if ((val & mask) != 0) { printf("1"); } else { printf("0"); } } printf("\n"); val = val << 1; usleep(500000); } } }
On 11/12/06, phygman <> wrote:
|
<Prev in Thread] | Current Thread | [Next in Thread> |
---|---|---|
|
Previous by Date: | [ts-7000] Re:Low power mode for TS-7300?, John Chung |
---|---|
Next by Date: | [ts-7000] TS-7260 Bricked After Boot to SD Card Modification Atempted, Kevin R. Battersby |
Previous by Thread: | [ts-7000] TS-7300, DIO & Keypad, phygman |
Next by Thread: | [ts-7000] serial ata - SATA-, gexpo1964 |
Indexes: | [Date] [Thread] [Top] [All Lists] |
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