Libstock prefers package manager

Package Manager

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]

Sort By

USER REQUESTS

first | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 last
Jan Verhoeff
jbv000

posted on 2011/11/11 07:11:29 PM CET

Measurement

code in Basic for gyro L3G4200D

Pls help me to start with code in Basic for gyro L3G4200D
For example a test read-out program
Thanks

Emmanuel Edwards
eddienuel

posted on 2011/10/21 05:53:56 PM CEST

Measurement

quadrature decoder

hello, please i need help on how to decode the quadrature signals from mechanical mouse for direction, using pic16f887 or 18f4520.
i will appreciate any solution in mikroC ,links and schematics or just an advice on how to go about it thanks

Stephen Madeira
Nemweb

posted on 2011/09/26 03:28:28 PM CEST

Measurement

Basic ADC on Mikrobasic

Hi everyone, I'd like to receive and basic mikrobasic code, just to read the AN0 of PIC16F876A and set PWM1 in the scale.
Thanks.

marcel nijssen
marcel n

posted on 2011/09/09 05:51:04 PM CEST

Measurement

Why is this not working ccp capture mode

hi i have a program to measurement the period of my rc receiver , total period and , how long the hi puls stay high.

here my code : im use easypic 5 , cristal 4mhz , pic16f877a , microkbasic V5.01

i have also a another program but its works , and thats it , not safe thats why i thy this .

[code]

Program puls_meting_1

' Procedure for high-going pulse:
' 1. Configure CCP to capture on rising edge
' 2. Setup Timer1 so it will not overflow during max pulse width time
' 3. Enable ccp capture
' 4. Once capture flag bit is set, save captured value as T1
' 5. Reconfigure CCP to capture on falling edge
' 6. On 2nd capture, save 2nd value as PW
' 7. Subtract T1 from PW for the pulse width value

'DEFINE OSC 4

Symbol Capture = PIR1.2 ' CCP1 capture flag
Dim PULS1 as WORD ' totaal tijdt
Dim PULS2 as WORD ' totaal tijdt
Dim T1 as WORD ' 1st capture value
Dim PW as WORD ' 2nd capture value & ultimately final pulse width
Dim T1_HighByte as WORD ' 1st capture value
Dim T1_LowByte as WORD ' 1st capture value
Dim PW_HighByte as WORD ' 1st capture value
Dim PW_LowByte as WORD ' 1st capture value
Dim Text as string[10]
dim LCD_RS as sbit at RB4_bit
LCD_EN as sbit at RB5_bit
LCD_D4 as sbit at RB0_bit
LCD_D5 as sbit at RB1_bit
LCD_D6 as sbit at RB2_bit
LCD_D7 as sbit at RB3_bit

LCD_RS_Direction as sbit at TRISB4_bit
LCD_EN_Direction as sbit at TRISB5_bit
LCD_D4_Direction as sbit at TRISB0_bit
LCD_D5_Direction as sbit at TRISB1_bit
LCD_D6_Direction as sbit at TRISB2_bit
LCD_D7_Direction as sbit at TRISB3_bit

'===============================================================================
'-------- PROCEDURES --- PROCEDURES --- PROCEDURES --- declarations ------------
'===============================================================================
sub procedure Lcd_leeg

Lcd_Cmd(_LCD_CLEAR) ' Clear display
Lcd_Cmd(_LCD_CURSOR_OFF) ' Cursor off
end sub

main:



TRISC.2 = 1 ' CCP1 input pin (Capture input on 16f877a)
INTCON = 0 ' Interrupts off
CCP1CON = %00000101 ' Capture mode, capture on rising edge
T1CON = 0 ' TMR1 prescale=1, clock=Fosc/4, TMR1=off
TMR1H = 0 ' Clear high byte of TMR1 counter
TMR1L = 0 ' Clear low byte
T1CON.0 = 1 ' Turn TMR1 on here
Capture = 0 ' Clear capture int flag bit

While(1)

While Not Capture ' Wait here until capture on rising edge
Wend

' Rising edge detected / stuff 'captured' Timer1 value in T1
T1_HighByte = CCPR1H
T1_LowByte = CCPR1L
TMR1H = 0 ' Clear high byte of TMR1 counter
TMR1L = 0 ' Clear low byte

PULS2 = (T1_LowByte - T1_HighByte) ' High pulse width = PW-T1
CCP1CON.0 = 0 ' Configure capture for falling edge now
Capture = 0 ' Clear capture interrupt flag bit

While Not Capture ' Wait here until capture on falling edge
Wend

' Falling edge detected / stuff 'captured' Timer1 value in PW
PW_HighByte = CCPR1H
PW_LowByte = CCPR1L
TMR1H = 0 ' Clear high byte of TMR1 counter
TMR1L = 0 ' Clear low byte

PULS1 = (PW_LowByte - PW_HighByte)

Lcd_Init() ' Initialize Lcd

Lcd_leeg()
'Lcd_Out(1,1,"Puls MS")
'WordToStr (PULS,Text)
'Lcd_Out (1,8 ,Text)

Lcd_Out(1,1,"H/L")
WordToStr (PULS1,Text)
Lcd_Out (1,5 ,Text)
Lcd_Out(1,11,"-")
WordToStr (PULS2,Text)
Lcd_Out (1, 12,Text)

Lcd_Out(2,1,"H/L")
WordToStr (T1_HighByte,Text)
Lcd_Out (2,5 ,Text)
Lcd_Out(2,11,"-")
WordToStr (T1_LowByte,Text)
Lcd_Out (2, 12,Text)
Delay_ms(10)

Wend
END.
[/code]

thank you for your responce, marcel nijssen

shivendra sahu
sahu

posted on 2011/08/20 12:05:50 PM CEST

Measurement

adc controlled relay \ led

i request every body which person use micro c \ basic.pl shear hear code sample which can drive adc controlled relay \ led etc bit vise.
RA0_bit= 1 or 0
RC2_bit= 1 or 0
RB5_bit= 1 or 0
RD3_bit= 1 or 0
ETC

first | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 last