#define Select_DS PORTD.B7 //May only DS,STCP and SHCP pins are used
#define Select_Clk PORTD.B6
#define Data_DS PORTD.B5
#define Data_Clk PORTD.B4
#define Relay PORTD.B3
#define Buzzer PORTD.B2
int k=0,i=0,j=0,l=0;
int arr_large[10] = {17,125,35,37,77,133,129,61,1,5};
void main() {
long int decimalNumber,remainder,quotient;
int binaryNumber[100],i=1,j,k;
TRISD = 0x00;
Select_Clk = 0;
Select_DS = 1; //1
Select_Clk = 1;
Select_Clk = 0;
Select_DS = 0; //2
Select_Clk = 1;
Select_Clk = 0;
Select_DS = 0; //3
Select_Clk = 1;
Select_Clk = 0;
Select_DS = 0; //4
Select_Clk = 1;
Select_Clk = 0;
Select_DS = 0; //5
Select_Clk = 1;
Select_Clk = 0;
Select_DS = 0; //6
Select_Clk = 1;
Select_Clk = 0;
/*Select_DS = 0; //7
Select_Clk = 1;
Select_Clk = 0;
Select_DS = 0; //8
Select_Clk = 1;
Select_Clk = 0;*/
while(1){
for(l=0;l<=9;l++){
quotient = arr_large[l];
//quotient = arr_large[7];
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i -1 ;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Data_Clk = 0;
Delay_us(10);
}
Data_Clk = 1;
Data_Clk = 0;
Delay_ms(1000);
}
}
}
#define Select_DS PORTD.B7
#define Select_Clk PORTD.B6
#define Data_DS PORTD.B5
#define Data_Clk PORTD.B4
#define Relay PORTD.B3
#define Buzzer PORTD.B2
// unsigned long int k=0,i=0,j=0,l=0;
unsigned int arr_small[10] = {24,222,52,148,210,145,17,220,16,144};
unsigned int arr_large[10] = {17,125,35,37,77,133,129,61,1,5};
unsigned int arr_med[10] = {20,126,140,44,102,37,5,124,4,36};
//unsigned int Select_FND[12] = {16,32,64,128,256,512,1024,2048,4096,8192,16384,32768};
unsigned int decimalNumber,remainder,quotient,decimalNumber_1,remainder_1,quotient_1;
unsigned int binaryNumber[100],binaryNumber_1[100],i=1,j,k,l=0,m=0,q=0;
void main()
{
TRISD = 0x00;
Select_Clk = 0;
Select_DS = 1;
Delay_us(5);
while(1){
Select_DS = 1;
Delay_us(5);
for(l=0;l<=4;l++){
quotient = arr_small[l];
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Delay_us(5);
}
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Select_Clk = 1;
Delay_us(5);
Select_DS = 0;
Select_Clk = 0;
Delay_ms(1000);
quotient = 255; //Data for blanking
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
Delay_us(2);
}
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
}
for(l=0;l<=4;l++){
quotient = arr_large[l];
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Delay_us(5);
}
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Select_Clk = 1;
Delay_us(5);
Select_DS = 0;
Select_Clk = 0;
Delay_ms(1000);
quotient = 255;
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
Delay_us(2);
}
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
}
for(l=0;l<=6;l++){
quotient = arr_med[l];
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Delay_us(5);
}
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Select_Clk = 1;
Delay_us(5);
Select_DS = 0;
Select_Clk = 0;
Delay_ms(1000);
quotient = 255;
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
Delay_us(2);
}
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
}
//Delay_us(5);
}
}
#define Select_DS PORTD.B7
#define Select_Clk PORTD.B6
#define Data_DS PORTD.B5
#define Data_Clk PORTD.B4
#define Relay PORTD.B3
#define Buzzer PORTD.B2
// unsigned long int k=0,i=0,j=0,l=0;
unsigned int arr_small[10] = {24,222,52,148,210,145,17,220,16,144};
unsigned int arr_large[10] = {17,125,35,37,77,133,129,61,1,5};
unsigned int arr_med[10] = {20,126,140,44,102,37,5,124,4,36};
//unsigned int Select_FND[12] = {16,32,64,128,256,512,1024,2048,4096,8192,16384,32768};
unsigned int decimalNumber,remainder,quotient,decimalNumber_1,remainder_1,quotient_1;
unsigned int binaryNumber[100],binaryNumber_1[100],i=1,j,k,l=0,m=0,q=0;
void main()
{
TRISD = 0x00;
Select_Clk = 0;
Select_DS = 1;
Delay_us(5);
while(1){
Select_DS = 1;
Delay_us(5);
for(l=0;l<=4;l++){
quotient = arr_small[l];
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Delay_us(5);
}
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Select_Clk = 1;
Delay_us(5);
Select_DS = 0;
Select_Clk = 0;
Delay_ms(1000);
quotient = 255; //Data for blanking
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
Delay_us(2);
}
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
}
for(l=0;l<=4;l++){
quotient = arr_large[l];
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Delay_us(5);
}
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Select_Clk = 1;
Delay_us(5);
Select_DS = 0;
Select_Clk = 0;
Delay_ms(1000);
quotient = 255;
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
Delay_us(2);
}
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
}
for(l=0;l<=6;l++){
quotient = arr_med[l];
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Delay_us(5);
}
Data_Clk = 1;
Delay_us(5);
Data_Clk = 0;
Select_Clk = 1;
Delay_us(5);
Select_DS = 0;
Select_Clk = 0;
Delay_ms(1000);
quotient = 255;
i=1;
while(quotient!=0){
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
for(i=i;i<=8;i++)
{
binaryNumber[i] = 0;
}
for(j = i-1;j> 0;j--){
Data_DS = binaryNumber[j];
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
Delay_us(2);
}
Data_Clk = 1;
Delay_us(2);
Data_Clk = 0;
}
//Delay_us(5);
}
}
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?