Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Programming in C for 89C51 example problem

Status
Not open for further replies.

8051HELP

Member level 1
Joined
Nov 27, 2015
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
251
I need to put on display NUMBER of elements in string which are less than 5.
SO i dont know how to put that result on display
HELP

Code:
byte string[16]={1,22,31,4,5,6,7,8,23,17,10,30,73,40,55,93};
byte i=0;
byte counter;
byte a;
byte xdata display _at_ 0x8002;
void Inic(void) {
	EA=1;
	ET0=1;
	TMOD=0x01;
	TH0=0x3C;
	TL0=0xAF;
	counter=20;
	i=0;
	TR0=1;
}

void timer0 (void) interrupt 1 using 2 {
 
 TH0=0x3C;
 TL0=0xAF;
 
if(counter==0) { counter=20;

 a= string[i];

  
 if(a<5) 
 display = a;
number++;
if(i==16) {i=0; }
i++;
}
counter--;
 TR0=0;
}

void main(void) {
 Inic();
 while(1){TR0=1;}
 }
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top