File "oc3test.c"
Full Path: /home/analogde/www/68hc11/oc3test.c
File size: 1.51 KB
MIME-type: text/x-c
Charset: utf-8
4aa
HTTP/1.1 200 OK
Date: Sat, 18 Jun 2005 20:19:39 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_perl/1.26 mod_ssl/2.8.9 OpenSSL/0.9.6g PHP/4.1.2
Last-Modified: Wed, 08 Jan 2003 19:43:02 GMT
ETag: "cac4a0-4aa-3e1c7f46"
Accept-Ranges: bytes
Content-Length: 1194
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/x-csrc
// filename oc3test.C
// test of OC3 interface
// Last modified 1/16/02 by Jonathan W. Valvano
// Copyright 2002 by Jonathan W. Valvano, valvano@uts.cc.utexas.edu
// You may use, edit, run or distribute this file
// as long as the above copyright notice remains
#include "HC12.h"
#include "oc3.h"
// stepper connected to PT4,PT2,PT1,PT0
const struct State{
unsigned char Out; /* Output to Port T */
const struct State *Next;
};
typedef const struct State StateType;
typedef StateType * StatePtr;
StatePtr Pt; /* Current State */
#define S5 &fsm[0]
#define S6 &fsm[1]
#define S10 &fsm[2]
#define S9 &fsm[3]
StateType fsm[4]={
{0x05,S6},
{0x06,S10},
{0x12,S9},
{0x11,S5}
};
void step(void){
PORTT = (PORTT&0xE8)+Pt->Out;
Pt = Pt->Next;
PORTT ^= 0x40;
}
void
0
main(void){
Pt = S5; // Initial State
COPCTL = 0x00; // disable COP
DDRT |= 0xFF; // PortT bit 6 is an output to an LED
Start(100,&step);
while(1){
}
}
#include "oc3.C"
extern void _start(); /* entry point in crt12.s */
#pragma abs_address:0xfffe
void (*reset_vector[])() = { _start };
#pragma end_abs_address