Duda simple, programar PIC en Pascal
Supongo sera con mokropascal con el que realizaras el programa
ye dejo un ejemplo:
//******************************************************************************
// microcontroller P16F84A
//
// Project name: counter8
// This project is designed to work with PIC 16F84A;
// with minor adjustments, it should work with any other PIC MCU
// that has TIMER0.
//
// This code demonstrates how to display a number on
// four 7-segment LED Display (common cathode).
// Each common cathode is connected to another pin of porta(RA0..RA3),
// in multiplex mode, with refresh via pins of porta, their anodes
// are connected to PORTB pins (segment A to RB0, segment B to RB1 etc)
// This code also demonstrates how to use interrupts in mikroPascal.
// Number is incremented every 1s.
//******************************************************************************
program Counter8;
var Counter,
i : word;
M0, M1,
M2, M3,
T1Count : BYTE;
procedure Interrupt;
begin
INTCON:= $00; // DISABLE INTERRUPTS
if counter = 10000 then
counter := 0;
T1count := T1count + 1; // increment value of brojac on every interrupt
TMR0 := 96;
INTCON := $20; // set T0IE, claer T0IF
end;
function LED_Mask(number: byte): byte; // This function returns led mask for common cathode display.
begin // Note the return value is not initialized.
case number of // In case 'number' is not in [0..9],
0: result := $3F;// mask '0' // the function will return unknown value
1: result := $06;// mask '1'
2: result := $5B;// mask '2'
3: result := $4F;// mask '3'
4: result := $66;// mask '4'
5: result := $6D;// mask '5'
6: result := $7D;// mask '6'
7: result := $07;// mask '7'
8: result := $7F;// mask '8'
9: result := $6F;// mask '9'
end;//case
end;
procedure WordToStr(number: word); // This procedure splits number into digits.
var pp: word; // It is assumed that the number is not greater
qq: word; // than 9999.
rr: word;
sss: word;
begin
//number := 4321
sss := (number div 1000);//sss := 4
M0 := LED_Mask(sss);
sss := sss*1000; //sss := 4000
rr := (number - sss) div 100; //rr := (4321-4000) mod 100 =3;
M1 := LED_Mask(rr);
rr := sss+rr*100; //rr := 4000+300
qq := (number -rr) div 10 ; //qq := 4321 -4300... = 21 div 10 =2
M2 := LED_Mask(qq);
qq := rr+qq*10;//qq := 4300+20= 4320
pp := number -qq;//pp := 4321 - 4320 = 1
M3 := LED_Mask(pp);
end;
begin
OPTION_REG := $84; // assign prescaler to TMR0
INTCON := $00; // DISABLE INTERRUPTS
TRISB := $00; // PORTB: ALL OUTPUTS
TRISA := $00; // PORTA: ALL OUTPUTS
T1COUNT := 0;
INTCON:= $A0; // ENABLE INTERRUPTS
Counter:=0;
i := 0;
while true do // endless loop
begin
if T1count = 200 then
begin
T1count := 0;
Counter := Counter +1;
end;
WordToStr(Counter); // split Counter to digits
PORTB := M3; // display digit
PORTA := 8; // turn ones display on
delay_us(1000); // wait for a while
PORTA := $00; // turn all displays off
if Counter >= 10 then// turn display on only in case upper digits are not equal to 0
begin
PORTB := M2; // display digit
PORTA := 4; // turn tens display on
delay_us(1000); //
PORTA := $00; // turn all displays off
end;
if Counter >= 100 then
begin
PORTB := M1; // display digit
PORTA := 2; // turn hundreds display on
delay_us(1000); //
PORTA := $00; // turn all displays off
end;
if Counter >= 1000 then
begin
PORTB := M0; // display digit
PORTA := 1; // turn thousands display on
delay_us(1000); //
PORTA := $00; // turn all displays off
end;
end; //while
end.
Espero esto te sirva sino comenta mas intentare darte mas datos.