program Teszt_int;
var
T1Count:byte;
procedure Interrupt;
begin
if testbit(PIR1,TMR1IE)=1 then
begin
T1Count:=T1Count+1;
if T1Count = 2 then
begin
T1Count := 0;
TMR1H := 23;
TMR1L := 184;
//1 second interrupt has occured
end;
end;
if testbit(intcon,int0If)=1 then
begin
//RB0 Int
end;
ClearBit(PIR1,TMR1IE);
clearbit(intcon,int0If);
end;
procedure init;
begin
intcon:=$00;
SetBit(intcon2, INTEDG0);
SetBit(intcon2, INTEDG1);
SetBit(intcon2, INTEDG2);
adcon1 := 255;
PORTA := 255;
TRISA := 255;
PORTB :=0;
TrisB :=0;
T1Count:=0;
ClearBit(PIE1, RCIE);
ClearBit(PIE1, TXIE);
SetBit(PIE1, TMR1IE);
setbit(intcon, gieh);
TMR1H := 23;
TMR1L := 184;
T1CON := $F9;
INTCON := $C0;
LCD_Init(PORTD);
lcd_cmd(LCD_CURSOR_OFF);
LCD_Out(1,1,'Start or Reset');
delay_ms(3000);
lcd_cmd(LCD_CLEAR);
end;
begin
init;
repeat
begin
LCD_Out(1,1,'Ok');
end;
until (0=1);
end.
program Teszt_int;
var
T1Count:byte;
a,b:word;
line:array[16] of string;
procedure Interrupt;
begin
if testbit(PIR1,TMR1IE)=1 then
begin
ClearBit(PIR1,TMR1IE);
T1Count:=T1Count+1;
if T1Count = 2 then
begin
T1Count := 0;
TMR1H := 23;
TMR1L := 184;
//1 second interrupt has occured
A:=A+1;
end;
end;
if testbit(intcon,int0If)=1 then
begin
//RB0 Int
B:=B+1;
clearbit(intcon,int0If);
end;
end;
procedure init;
begin
a:=0;
b:=0;
intcon:=$00;
setbit(intcon2, INTEDG0);
PORTB :=$FF;
TrisB :=$FF;
T1Count:=0;
SetBit(PIE1, TMR1IE);
setbit(intcon, gieh);
TMR1H := 23;
TMR1L := 184;
T1CON := $F9;
INTCON := $D0;
LCD_Init(PORTD);
lcd_cmd(LCD_CURSOR_OFF);
LCD_Out(1,1,'Start or Reset');
delay_ms(3000);
LCD_Out(1,1,' ');
end;
begin
init;
repeat
begin
wordtostr(a,line);
LCD_Out(1,1,'TMR');
LCD_Out(1,10,line);
wordtostr(b,line);
LCD_Out(2,1,'RB0');
LCD_Out(2,10,line);
end;
until (0=1);
end.
That's why it's a good idea to always enable BOR in the configuration fuses. And I would normally set the BOV to the highest possible value.suryakant said:Situation like this may damage at least that port pin and may contoller too because of PD due to short.
RB0 ---------/-----\/\/\---Vcc
| R
[] R
|
_
GND
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?