Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Single chip microcomputer program for annotation
Single chip microcomputer program for annotation
Scm program note # include < reg52.h & gt// Call MCU header file.

# definechar unsigned char//unsigned character macro defines variables in the range of 0~255.

The # define uint unsigned int//unsigned integer macro defines the variable range from 0 to 65535.

# include & ltintrins.h & gt// With him, feel free to use these keywords.

/* _crol_ character cycle left shift

_cror_ character cycle right shift

_irol_ integer cycle left shift

_iror_ integer cycle right shift

_lrol_ Long integer cycle left shift

_lror_ Long integer cycle right shift

_nop_ Null operation 805 1 NOP instruction

0 1 2 3 4 5 6 7 8 9

Uchar code smg_du[]={0x28, 0xe 1, 0x32, 0xa2, 0x54, 0xa 1, 0x2 1, 0xea, 0x20, 0xa0,

There are codes in a, b, c, d, e, f, G// arrays, but there are no codes in ROM.

0x60,0x25,0x39,0x26,0x3 1,0x7 1,0x ff }; //Definition of digital tube segment selection

Uchar code smg_we[]={0xef, 0xdf, 0xbf, 0x7f };; //Definition of digital tube position selection

uchar dis _ SMG[8]= { 0 };

uchar SMG _ I = 4; //Displays the unit number of the digital tube.

sbit beep = p2^3; //Buzzer IO port definition

Bit flag _ lj _ en// button is connected and enabled.

The bit flag _ lj _ 3 _ en// has a large number of keys that can be added after three consecutive times.

Uchar key_time, key _ value// are used as intermediate variables in series.

bit key _ 500ms

Bit flag _ 300ms

uchar menu _ 1; //Variables for menu design

Uint t _ high = 20// upper limit alarm value

sbit hx7 1 1_dout=p2^7;

sbit hx7 1 1_sck=p2^6; //hx7 1 1 module port selection

Long weight;

Unsigned long integer hx711_ buffer = 0;

Unsigned long integer Weight _ Maopi = 0;;

Unit temperature, qi _ weight

Zhong Chao _ sign;

Reggie _ sign;

uchar flag _ 200ms

# Define Gap Value 437.0

Unit temperature, qi _ weight

Zhong Chao _ sign;

Reggie _ sign;

/* * * * * * * * * * * * * * * *1ms delay function * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Void delay_ 1ms(uint q)// unsigned shaping parameter q

{

uint i,j; //define unsigned integer variables I and J.

for(I = 0; I & ltq;; I++) // the variable I is added from 0 to Q.

for(j = 0; j & lt 120; j++); //The variable j is added from 0 to 120.

}

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Empty display ()

{

Static uchari I; //Apply for unsigned character variable i.

i++;

If (i>= smg_i)// If it is greater than or equal to smg i, it will be executed downwards.

I = 0; The variable I is cleared to 0.

p 1 = 0x ff; //blanking MCU p 1 sending11111.

P3 = SMG _ we[I]; //Bit selection array I is sent to P3 port of single chip microcomputer.

p 1 = dis _ SMG[I]; //The contents of segment selection array I are sent to port p 1.

}

/* * * * * * * * * Timer0 initialization program * * * * * * * * * * * * * *

Invalid test