SlimG
Joined: 03 Dec 2004 Posts: 6
|
How can I return Array valves to Port B? p.s see code |
Posted: Tue Feb 01, 2005 7:36 am |
|
|
I am trying to put the value of d i.e 1 in the array list, to port_B.
can anyone help?
thanx for previous replies.
regards.
#if defined(__PCM__)
#include <16F873.H>
#include <stdlib.h>
#include <stdio.h>
#endif
#Fuses XT,NOWDT,NOPUT
#USE DELAY (CLOCK=4000000)
#BIT IRP=0x3.7 /* BANK SELECT*/
#byte PORT_B=6
/* PORT A INI*/
#BIT PCFG3 =0x9F.2
#BIT PCFG2 =0x9F.1
#BIT PCFG1 =0x9F.0
/* PORTB INI*/
int a, b,d;
main () {
char valv[10]={
0b00111111, //0
0b00000110, //1
0b01011011, //2
0b01001111, //3
0b00100111, //4
0b01101101, //5
0b01111101, //6
0b00000111, //7
0b01111111, //8
0b01101111 //9
};
//float value; /*had float value*/
DISABLE_INTERRUPTS(GLOBAL); /* ALL INTS OFF*/
IRP=0;
PCFG3 =0;
PCFG2 =1;
PCFG1 =0;
SET_TRIS_A (0x02); /*RAO AND RA1 AS INPUTS*/
set_tris_b (0xff);
setup_timer_0 (RTCC_DIV_2|RTCC_INTERNAL);
while(true)
{
d=1;
port_b=valv[d];
}
} |
|