RE: [uCsimm] Generic IO Ports

From: Steven Merrifield (smerrifield@tecom.com.au)
Date: Thu Jul 19 2001 - 19:07:47 EDT


Hi,

Well first of all, there is a nice example in the uCsimm manual
to flash a LED. This is a good starting point. Secondly, read
the manual for the 68EZ328, specifically Section 7 - Parallel Ports.

The manual example shows how to setup a pin as an output.

I have attached a simple example to read a pin as an input. I use
this code to check for a jumper at power-on to setup the default
networking parameters which are stored in EEPROM.

Cheers,
steve

/***********************************************************************
  check_default.c

  Default header is on PD6 (SIMM pin 16), and is normally high.
  If it is read as low, then the default conditions should be restored.

  sjm July 2001

************************************************************************/

#include <asm/MC68EZ328.h>

int main(void)
{

  PDSEL |= 0x40; /* bit 6 type = IO pin */
  PDDIR &= 0xBF; /* bit 6 direction = input */

  if (PDDATA & 0x40) /* if it's not == 0, then do not restore defaults */
    exit(0);

  printf("Default header was detected - resetting default parameters\n");
  /* set default conditions here */
  return(0);
}

-----Original Message-----
From: James [mailto:james@telserco.com]
Sent: Friday, 20 July 2001 4:34
To: 'ucsimm@uclinux.org'
Subject: [uCsimm] Generic IO Ports

        Can anyone give me a simple example of how to read and write to the
Generic IO Pins on the ucsimm. I have browsed some different source code to
try to determine how and so far I have been unsuccessful.

Thanks in advance.

James Kinney
This message resent by the ucsimm@uclinux.com list server
http://www.uClinux.com/
This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:43 EST