#include #include "ht1632c.h" #include const unsigned char balken[] = {0x00, 0x08, 0x0C, 0x0E, 0x0F, 0x8F, 0xCF, 0xEF, 0xFF}; //16 LED Balken void ht1632_wait(void) { asm volatile ("nop"); // kann evtl. für schnelle uC angepasst werden! ist aber bis 16MHz getestet und stabil } void init_command(unsigned int command_data) { unsigned int i,j; command_data=command_data&0xfff; command_data=command_data<<4; led_port |= (1<>15; if (j==1) led_port |= (1<>= 1; } } void ht1632_data(unsigned char data) { unsigned char i,temp; temp = 0x08; //data has 4 bits for(i=0;i<4;i++) { led_port &= ~(1<>= 1; } } void ht1632_send(unsigned char address, unsigned char data) { led_port |= (1<>= 4; ht1632_send(pos+1, temp&0x0F); ht1632_send(pos+2, 0x00); ht1632_send(pos+3, 0x00); } else { ht1632_send(pos, 0x0F); ht1632_send(pos+1, 0x0F); temp = balken[number-8]; ht1632_send(pos+2, temp&0x0F); temp >>= 4; ht1632_send(pos+3, temp&0x0F); } }