Oki JOB60851 User Manual

Page 60

Advertising
background image

Chapter 4 Software Development

page 4-25

Sample Port 7 Control Program

/* Sample program(Port7) */

/* Filename:port7exp.c */

/* Copyright(C) 1999 TECHNOCOLLAGE,Inc. All rights reserved. */

#include<stdio.h>

#include<stdlib.h>

#include<m66573.h>

void main(void)

{

int i = 0;

unsigned int j = 0;

std_init_573();

/* Initialize MSM66Q573 and the port */

P7 = 0x00;

/* 0000_-000 */

/* Clear output data. 00B = orange */

P7IO = 0xC2;

/* 1100_-010 */

/* Configure Port 7 pin 1 for output */

P7SF = 0x03;

/* 0000_-011 */

/* Configure Port 7 pins 1 and 0 for secondary function

*/

S0BUF = 0x0A;

printf_c

(" LED should now be orange \n");

/* Time waster (sleep) */

for(i=0;i<10;i++)

{

for(j=0;j<65535;j++);

}

printf_c

(" LED should now be green \n");

P7_7 = 0;

/* 01B = green */

P7_6 = 1;

/* Time waster (sleep) */

for(i=0;i<10;i++)

{

for(j=0;j<65535;j++);

}

printf_c

(" LED should now be red \n");

P7_7 = 1;

P7_6 = 0;

/* 10B = red */

}

Advertising