CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How can I return Array valves to Port B? p.s see code

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
SlimG



Joined: 03 Dec 2004
Posts: 6

View user's profile Send private message

How can I return Array valves to Port B? p.s see code
PostPosted: Tue Feb 01, 2005 7:36 am     Reply with quote

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];


}
}
valemike
Guest







set_tris_b is wrong
PostPosted: Tue Feb 01, 2005 7:48 am     Reply with quote

I see that you have set_tris_b(0xFF) is wrong, since you have configured them as all inputs. You should write set_tris_b(0x00);

port_b = valv[x]; is correct though.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group