T.ex först 7 entalsblink, sen 3 tiotalsblink och sist 1 hundratalsblink. 137.

Eller samma lysdiod, med en liten paus mellan ental/tiotal osv.
Kod: Markera allt
program AD16F88;
{main procedure}
//******************************************************************************
// microcontroller : P16F88
// -CONFIG-
// [X] CP_OFF [X] DEBUG_OFF [X] WRT_ENABLE_OFF,
// [X]CPD_OFF [X]LVP_OFF [X] BODEN_OFF,
// [X]MCLR_OFF [X] PWRTE_OFF [X] WTD_OFF
// [X] INTRC_IO
// -CONFIG2-
// [X] IESO_OFF [X] FCMEN_OFF
//
// Version: 1.0.1.0
// ---------------------------------------------------------------------------
// Svenska.
// Projekt: Växelknopp till Nissan Datsun 120A FII
// Detta projekt är disangat att fungera med PIC 16F88.
//
// English.
// Project: Shiftingnobb too Nissan Datsun 120A FII
// This project is disaged too work with PIC 16F88.
//******************************************************************************
Var
Vexel:Word;
Mode,Tic,Puls,Xeet,A,Intro:byte;
begin
//Setup
OSCCON := %11111110; // internal 8mHz osc
ANSEL := 0; // just want digital inputs - default is for ADC
TRISA := 0; // designate gpio as output
TRISB := 0;
ADCON1:=0;
CMCON:=7; //turns off the comparitors
For Intro:=1 to 10 do
Begin
//-Power on!
PortA:=$00; //1 - 00
PortB:=$04; //1 - 04
delay_ms(300);
PortA:=$10; //3 - 04 NY
PortB:=$00; //3 - 00 NY
delay_ms(300);
PortA:=$04; //4 - 04
PortB:=$00; //4 - 00
delay_ms(300);
PortA:=$40; //5 - 40
PortB:=$00; //5 - 00
delay_ms(300);
PortA:=$00; //6 - 00 NY
PortB:=$01; //6 - 01 NY
delay_ms(300);
PortA:=$00; //7 - 00
PortB:=$20; //7 - 20
delay_ms(300);
End;
Tic:=0;
Puls:=0;
Xeet:=0;
Mode:=1;
{ PortA:=$FF; //8 - 86
PortB:=$FF; //8 - 30 ZI
delay_ms(5000);
PortA:=$01; //8 - 86
PortB:=$00; //8 - 30 ZI
delay_ms(18000);
PortA:=$02; //9 - 86
PortB:=$00; //9 - 30 ZI
delay_ms(18000);
PortA:=$00; //10 - 86
PortB:=$00; //10 - 30 ZI
delay_ms(18000);
PortA:=$08; //11 - 86
PortB:=$00; //11 - 30 ZI
delay_ms(18000);
PortA:=$10; //12 - 86
PortB:=$00; //12 - 30 ZI
delay_ms(18000);
PortA:=$20; //13 - 86
PortB:=$00; //13 - 30 ZI
delay_ms(18000);
PortA:=$40; //14 - 86
PortB:=$00; //14 - 30 ZI
delay_ms(18000);
PortA:=$80; //15 - 86
PortB:=$00; //15 - 30 ZI
delay_ms(18000);
{ PortA:=$11; //16 - 86
PortB:=$31; //16 - 30 ZI
delay_ms(8000); }
{
delay_ms(1000);
Vexel:=ADC_read(0);
Vexel:=ADC_read(0);
Vexel:=ADC_read(0);
PortA:=$04;
delay_ms(5000);
PortA:=$00;
For Intro:=0 to Vexel do
Begin
PortB:=$FF;
delay_ms(300);
PortB:=$00;
delay_ms(300);
End;
}
repeat // beginning of a repeat endless loop
Begin
Tic:=Tic+1;
If Tic=10 then
Begin
Puls:=Puls+1;
If Puls=2 then Puls:=0;
Tic:=0;
Xeet:=Xeet+1;
End;
If Xeet=5 then
Begin
Mode:=Mode+1;
Xeet:=0;
End;
If Mode=4 then
Begin
Mode:=1;
End;
Vexel:=0;
A:=0;
Vexel:=ADC_read(0);
{If Vexel>0 then
Begin
If Vexel<=2 then
Begin
//Friläge
PortB:=$C3;
PortA:=$90;
End;
End;}
If Vexel>=5 then
Begin
If Vexel<=170 then
Begin
//1
PortA:=$80;
PortB:=$00;
A:=1;
End;
End;
If Vexel>=171 then
Begin
If Vexel<=345 then
Begin
//2
PortA:=$1A;
PortB:=$51;
A:=1;
End;
End;
If Vexel>=346 then
Begin
If Vexel<=521 then
Begin
//3
PortA:=$1A;
PortB:=$13;
A:=1;
End;
End;
If Vexel>=525 then
Begin
If Vexel<=699 Then
Begin
//4
PortA:=$18;
PortB:=$83;
A:=1;
End;
End;
If Vexel>=700 then
Begin
If Vexel<=900 Then
Begin
//R
PortA:=$1A;
PortB:=$C5;
A:=1;
eND;
End;
If A=0 then
Begin
PortB:=$C3;
PortA:=$90;
End;
End;
until 0 = 1; // endless loop (as this condition is never satisfied)
end.