We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
posted on 2013/03/18 06:27:57 AM CET
Hi to every one ,is there any one that have a example code for using the capture of the ccp module ,i am new to PIC programming, i want to use the code to measure the pulse widht of a incoming frequency at pin RB3 , i am using the Pic 16f88, and the compiler is mikro c,i do know how to set it up ,my problem is the interrupt and the read of the value in the CCPR1 register,
Thanks in advance.
posted on 2013/02/12 12:03:43 AM CET
Hi
I am new to PIC programming..
Can anybody help me to "interface a rotary encoder (with push switch) with PIC16F877A" ( MikroC)....
it is for making a channel volume controller using PT2258..
With Regards
Sreeraj
posted on 2013/02/06 03:08:42 AM CET
Hi
The code below dose work but dose not calculate the distance propply
can some kind person tell me what i am doing wrong
program MyPortB
#DEFINE OSC 20
' pic16f877
dim LCD_RS as sbit at RD2_bit
LCD_EN as sbit at RD3_bit
LCD_D4 as sbit at RD4_bit
LCD_D5 as sbit at RD5_bit
LCD_D6 as sbit at RD6_bit
LCD_D7 as sbit at RD7_bit
dim LCD_RS_Direction as sbit at TRISD2_bit
LCD_EN_Direction as sbit at TRISD3_bit
LCD_D4_Direction as sbit at TRISD4_bit
LCD_D5_Direction as sbit at TRISD5_bit
LCD_D6_Direction as sbit at TRISD6_bit
LCD_D7_Direction as sbit at TRISD7_bit
dim Triger as sbit at portb.2
dim ch as string[8]
dim number as word
main:
trisa=0
Trisb =0 ' designate portb as output (LCD is connected to portb)
trisc=0
portb=0
trisd=0
portd=0
trisb.4 =1
trisb.2=0
Lcd_Init() ' initialize (4-bit interface connection)
Lcd_Cmd(_LCD_CURSOR_OFF) ' send command to LCD (cursor off)
Lcd_Cmd(_LCD_CLEAR)
Lcd_Out(1,1,"Number")
number=00
while true '
Ow_Reset(PORTB, 4)
Triger =true '1 ' portb.2 =1
delay_us(50)
Triger =false ' 0 ' portb.2=0
number = Ow_Read(PORTB, 4)
number = number + (Ow_Read(PORTB, 4) << 8)
number = (number /2)/ 29.1
wordToStr(number, ch)
Lcd_Out(2,8,ch)
delay_us(500)
wend
' Main program
end.
posted on 2013/02/06 03:08:35 AM CET
Hi
The code below dose work but dose not calculate the distance propply
can some kind person tell me what i am doing wrong
program MyPortB
#DEFINE OSC 20
' pic16f877
dim LCD_RS as sbit at RD2_bit
LCD_EN as sbit at RD3_bit
LCD_D4 as sbit at RD4_bit
LCD_D5 as sbit at RD5_bit
LCD_D6 as sbit at RD6_bit
LCD_D7 as sbit at RD7_bit
dim LCD_RS_Direction as sbit at TRISD2_bit
LCD_EN_Direction as sbit at TRISD3_bit
LCD_D4_Direction as sbit at TRISD4_bit
LCD_D5_Direction as sbit at TRISD5_bit
LCD_D6_Direction as sbit at TRISD6_bit
LCD_D7_Direction as sbit at TRISD7_bit
dim Triger as sbit at portb.2
dim ch as string[8]
dim number as word
main:
trisa=0
Trisb =0 ' designate portb as output (LCD is connected to portb)
trisc=0
portb=0
trisd=0
portd=0
trisb.4 =1
trisb.2=0
Lcd_Init() ' initialize (4-bit interface connection)
Lcd_Cmd(_LCD_CURSOR_OFF) ' send command to LCD (cursor off)
Lcd_Cmd(_LCD_CLEAR)
Lcd_Out(1,1,"Number")
number=00
while true '
Ow_Reset(PORTB, 4)
Triger =true '1 ' portb.2 =1
delay_us(50)
Triger =false ' 0 ' portb.2=0
number = Ow_Read(PORTB, 4)
number = number + (Ow_Read(PORTB, 4) << 8)
number = (number /2)/ 29.1
wordToStr(number, ch)
Lcd_Out(2,8,ch)
delay_us(500)
wend
' Main program
end.
posted on 2013/01/28 06:43:10 PM CET
Hi
can someone help me with mikrobasic code for ultasonic module HC-SR04 to measure distance to a LCD with a pic16f877
i'v had a look around the net and all i can find is some code in C going to a Serial port
i am a beginer