普中的stc89c52LCD会影响到pwm的输出吗,LCD用到了p2^5---p2^7和p2口,pwm的用到的是p3^4口#include "lcd.h"#include <REG52.H>
#define PLUS_PER 330
extern int interruptcounter; //ía2¿ÖD¶Ï′Îêy
extern unsigned int speed ;
extern unsigned long PlusCounter; //ía2¿Âö3å¸öêy
void LCD_Write_String(unsigned char *p);
void LcdWriteData(uchar dat); //D′èëêy¾Y
void LcdWriteCom(uchar com) ; //D′èëÃü
void LcdInit(); //LCD3õê¼»ˉ×ó3ìDò
void gotoxy(unsigned char x,unsigned char y); //ÔúxDDyáDÏÔê¾êy¾Y
void ClacSpeed() //êy¾Y′|àíoˉêy
{ int speed ;
unsigned long PlusCounter;
PlusCounter =interruptcounter;
speed =(PlusCounter/PLUS_PER)*60;//ÿ·ÖÖóμÄ×aêy
{
// gotoxy(1,1);
// LCD_Write_String("V= ");
// gotoxy(1,3);
// LcdWriteData((speed/1000)%10+0x30);
// gotoxy(1,4);
// LcdWriteData((speed/100)%10+0x30);
// gotoxy(1,5);
// LcdWriteData((speed/10)%10+0x30);
// gotoxy(1,6);
// LcdWriteData(speed%10+0x30);
// gotoxy(1,7);
// LCD_Write_String("r");
// gotoxy(1,8);
// LCD_Write_String("/");
// gotoxy(1,9);
// LCD_Write_String("m");
// gotoxy(1,10);
// LCD_Write_String("i");
// gotoxy(1,11);
// LCD_Write_String("n");
interruptcounter=0;
}
}
void gotoxy(unsigned char x,unsigned char y) //ÔúxDDyáDÏÔê¾êy¾Y
{
if(x==1)
{
LcdWriteCom(0x80+y-1);
}
if(x==2)
{
LcdWriteCom(0xc0+y-1);
}
}
|