Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Its C... You have to use XC8 to compile it.... That is MPASM... Assembler!This is the error I got when compile...
Yes Boss.. The resistor connection is wrong. But I change the conection.
I cant complie your programme in MPLAB v8.33. showing some more error.
Reguards Manoj
#include <htc.h>
//#include <pic.h>
#define _XTAL_FREQ 4000000 // Xtal speed
//#pragma config CONFIG = 0x3194 //
__CONFIG (0x3194); //
char ISRcount=0;
void interrupt ISR()
{
if(TMR1IF)
{
if(ISRcount++ == 0x14) // A for 5 seconds
{
GPIO = 0;
ISRcount = 0;
TMR1IE = 0;
}
TMR1H = 0xB;
TMR1L = 0xDB;
TMR1IF = 0;
}
}
void initchip()
{
T1CON = 0x35;
TMR1IE = 0;
TMR1H = 0xB;
TMR1L = 0xDB;
TMR1IE = 0;
GIE = PEIE = 1;
}
void main(void)
{
TRISIO =0x1;
GPIO = 0x0;
ANSEL = 0;
IOCB = 0;
WPU = 0;
CMCON = 0x7;
initchip();
while(1)
{
if(GPIO0)
{
GPIO1 = 1;
TMR1IE = 1;
}
}
}
In Allen Code, How I set output 5 seconds to 5 blinks?
I use this ;-
delay_1s:
MOVLW d'5'
MOVWF LRAM_0x21
LOOP1: DECFSZ LRAM_0x21,W
GOTO LOOP1
RETURN
and a Call function added
CALL delay_1s
Is right? proteus not working..
;PIC Time Delay = 0.5000020 s with Osc = 4.000000 MHz
movlw D'3'
movwf CounterC
movlw D'140'
movwf CounterB
movlw D'83'
movwf CounterA
loop decfsz CounterA,1
goto loop
decfsz CounterB,1
goto loop
decfsz CounterC,1
goto loop
retlw
; RAM-Variable
LRAM_0x20 equ 0x20
ISRCOUNT equ 0x21 ;count number of interrupt
LRAM_0x22 equ 0x22
LRAM_0x23 equ 0x23
LRAM_0x24 equ 0x24
LRAM_0x25 equ 0x25
LRAM_0x26 equ 0x26
CounterA equ 0x27
CounterB equ 0x28
CounterC equ 0x29
LRAM_0x50 equ 0x50
LRAM_0x5C equ 0x5C
LRAM_0x5D equ 0x5D
LRAM_0x5F equ 0x5F
I am trying 5 seconds to 5 Blinks... Is it can done in Ian C programme?
#include <htc.h>
//#include <pic.h>
#define _XTAL_FREQ 4000000 // Xtal speed
//#pragma config CONFIG = 0x3194 //
__CONFIG (0x3194); //
char ISRcount=0;
void interrupt ISR()
{
if(TMR1IF)
{
if(ISRcount++ == 0x14) // A for 5 seconds
{
GPIO = 0;
ISRcount = 0;
TMR1IE = 0;
}
TMR1H = 0xB;
TMR1L = 0xDB;
TMR1IF = 0;
}
}
void initchip()
{
T1CON = 0x35;
TMR1IE = 0;
TMR1H = 0xB;
TMR1L = 0xDB;
TMR1IE = 0;
GIE = PEIE = 1;
}
void main(void)
{
TRISIO =0x1;
GPIO = 0x0;
ANSEL = 0;
IOCB = 0;
WPU = 0;
CMCON = 0x7;
initchip();
while(1)
{
if(GP0)
{
TMR1IE = 1;
while(TMR1IE)
{
__delay_ms(200); // delay for flash
GP1 = 1;
__delay_ms(200); // delay for flash
GP1 = 0;
}
}
}
}
Can you provide the hex file?
I cant compile...
Reguards Manoj