pic.programmer
Advanced Member level 3
- Joined
- Aug 19, 2015
- Messages
- 773
- Helped
- 141
- Reputation
- 284
- Reaction score
- 140
- Trophy points
- 43
- Activity points
- 7,531
unsigned int myInt = 32;
unsigned int myFunction1(unsigned int myLoclInt) {
return myLocalInt * 2;
}
unsigned int myFunction2(unsigned int myLoclInt) {
return myLocalInt * 2;
}
void main() {
while(1) {
myInt = myFunction1(myFunction2(myInt));
}
}
#include <reg51.h>
#include <math.h>
typedef unsigned char byte;
byte a[16]={1,22,31,4,5,6,7,8,23,3,10,30,73,40,55,93};
byte b[16]={3,14,7,13,17,19,97,1,12,128,127,124,123,122,33,21};
byte c[16]={9,15,4,13,41,49,57,18,74,3,39,59,112,100,91};
byte d[16]={33,58,68,66,21,19,97,1,14,222,56,12,3,9,15,11};
sbit switcher=P0^0;
byte i=0;
byte counter;
byte xdata display _at_ 0x8001;
void Inic(void) {
EA=1;
ET0=1;
TMOD=0x01;
TH0=0xC3;
TL0=0x50;
TR0=1;
counter=0;
i=0;
}
void timer0 (void) interrupt 1 using 2 {
TH0=0xC3;
TL0=0x50;
if((++counter==0)) { counter=20;
if(switcher) {
if(!(a[i]%3) )
display = a[i];
i++;
if(i==16) i=0;
if(!(b[i]%3) )
display = b[i];
i++;
if(i==16) i=0;
if(!(c[i]%3) )
display = c[i];
i++;
if(i==16) i=0;
if(!(d[i]%3) )
display = d[i];
i++;
if(i==16) i=0;
}}
TR0=0;
}
void main(void) {
Inic();
while(1){TR0=1;}
}
#include <AT89X55.H>
#include <MATH.H>
//#include <lcd.h>
sfr lcd_data_pin=0xA0; // data port P2
sbit rs=P3^7; // Register select pin
sbit rw=P3^6; // Read write pin
sbit en=P3^5; // Enable pin
sbit power_hz=P1^0; // Frequency Count
unsigned long c,d,frequency,rpm_count,rpm;
unsigned char d1,d2,d3,d4,d5,pulse_ov,pulse_count,lo_count;
void delay(unsigned int msec) //delay function
{
int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void lcd_command(unsigned char comm) // function to send command to LCD
{
lcd_data_pin=comm;
en=1;
rs=0;
rw=0;
delay(1);
en=0;
}
void lcd_data(unsigned char disp) // function to send data on LCD
{
lcd_data_pin=disp;
en=1;
rs=1;
rw=0;
delay(1);
en=0;
}
lcd_dataa(unsigned char *disp) // function to send string to LCD
{
int x;
for(x=0;disp[x]!=0;x++)
{
lcd_data(disp[x]);
}
}
void lcd_ini() //Function to inisialize the LCD
{
lcd_command(0x38);
delay(5);
lcd_command(0x0C);
delay(5);
}
void timer0 (void) interrupt 1
{
TF0 = 0x00;
pulse_count = pulse_count++;
if (pulse_count == 1)
{
P1 = 0x00;
delay(100);
}
else
{
P1 = 0xff;
delay(100);
return;
}
}
void ISR_timer1 (void) interrupt 3
{
TF1 = 0;
pulse_ov = ++pulse_ov;
}
void rpm_start()
{
pulse_ov = 0x00;
pulse_count = 0x00;
TH1 = 0x00;
TL1 = 0x00;
ET1 = 1;
ET0 = 1;
EA = 1;
TR0 = 1;
}
void main()
{
P1 = 0xff;
lcd_ini();
TMOD = 0x16;
T2CON = 0x01;
IT0 = 1;
IE0 = 1;
EX0 = 1;
EA = 1;
rpm_start();
}
void timer0 (void) interrupt 1 using 2 {
if (++interruptcnt == 4000) { /* count to 4000 */
second++; /* second counter */
interruptcnt = 0; /* clear int counter */
}
#include <AT89X55.H>
#include <MATH.H>
void timer0 (void) interrupt 1
{
P1 = 0x00;
delay(100);
P1 = 0xff;
delay(100);
return;
}
void rpm_start()
{
pulse_ov = 0x00;
pulse_count = 0x00;
TH1 = 0x00;
TL1 = 0x00;
ET1 = 1;
ET0 = 1;
EA = 1;
TR0 = 1;
}
void main()
{
P1 = 0xff;
TMOD = 0x16;
T2CON = 0x01;
IT0 = 1;
IE0 = 1;
EX0 = 1;
EA = 1;
rpm_start();
}
void timer0 (void) interrupt 1
{
P1 = 0x00;
delay(100);
P1 = 0xff;
delay(100);
return;
}
void main()
{
P1 = 0xff;
lcd_ini();
TMOD = 0x16;
T2CON = 0x01;
IT0 = 1;
IE0 = 1;
EX0 = 1;
// EA = 1;
}
void timer0 (void) interrupt 1
{
P1 = 0x00;
delay(100);
P1 = 0xff;
delay(100);
return;
}
void main()
{
P1 = 0xff;
lcd_ini();
TMOD = 0x16;
T2CON = 0x01;
IT0 = 1;
IE0 = 1;
EX0 = 1;
EA = 1;
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?