产生三角波的程序
#include "reg51.h"#include "absacc.h"
#define DAC0832 XBYTE[0x7fff] //定义DAC0832的端口地址
#define uchar unsigned char
void main(void)
{
uchar i;
LOOP:while(1)
{
for (i=0;i<=255;i++)
DAC0832=i;
for (i=255;i>=0;i--)
DAC0832=i
}
goto LOOP;
}