Search Results - MEL PICBASIC Forum

# Search:

Type: Posts; User: richard; Keyword(s):

Page 1 of 4 1

1. ## Thread: 125KHz HW PWM Output

by richard
Replies
9
Views
315

### Re: 125KHz HW PWM Output

your understanding is flawed and math is incorrect

Duty is Steps x 0.625% // steps = CCPR1L x4 + CCP1CON<5:4>

so:
80x0.625% = 50% <=> steps = 20x4 + 0
56x0.625% = 35% ...
2. ## Thread: 125KHz HW PWM Output

by richard
Replies
9
Views
315

### Re: 125KHz HW PWM Output

totally missing the point

CCPR1L = \$14 not 14 ; its hex 14 or dec 20
3. ## Thread: 125KHz HW PWM Output

by richard
Replies
9
Views
315

### Re: 125KHz HW PWM Output

maybe more like duty cycle of 2.8us/8us * 100 = 35%

or correctly
' To get a 50% duty cycle output,
CCPR1L to \$14 and CCP1CON<5:4> to <0:0>.
4. ## Thread: Sleep does not really sleep...

by richard
Replies
8
Views
422

### Re: Sleep does not really sleep...

from the data sheet, my best guess . i see no attempt to read portb before sleep
5. ## Thread: PIC18FxxQ43 Version of DT_INTS

by richard
Replies
25
Views
1,913

### Re: PIC18FxxQ43 Version of DT_INTS

You need to travel back in time ten years , last known semi workable setup was with mplabx 2.35
6. ## Thread: Data processing in array

by richard
Replies
12
Views
673

### Re: Data processing in array

i would not expect to ever receive a malformed bit from a keeloq serial stream , the data may be useless however.
single point sampling should be ok imho
7. ## Thread: How to detect variable going below zero, without using PBPL ?

by richard
Replies
18
Views
1,161

### Re: How to detect variable going below zero, without using PBPL ?

in simple terms adding the two's compliment of a var to a number is equivalent to subtracting the var from a number
providing they are all the same integer var type
8. ## Thread: Data processing in array

by richard
Replies
12
Views
673

### Re: Data processing in array

In a noisy environment you can over sample a bit to be sure of data validity, i expect the serial data from a keeloq
chip to be quite clean so a single sample point would suffice

sample...
9. ## Thread: Data processing in array

by richard
Replies
12
Views
673

### Re: Data processing in array

a couple of ways

pulsetrain:
index=67
while index
while !portb.0 :wend ;wait for hi
index=index-1
pauseus 600 ;bit period=3*te ie 3*400=1200uS
code.0[index]= ~...
10. ## Thread: Data processing in array

by richard
Replies
12
Views
673

### Re: Data processing in array

result of sim
9225
11. ## Thread: Data processing in array

by richard
Replies
12
Views
673

### Re: Data processing in array

maybe but it has positive indication of failure , it ceases testing on failure and it actually detects failures.
i would not be quibbling over a few words of code space when the entire process of...
12. ## Thread: Data processing in array

by richard
Replies
12
Views
673

### Re: Data processing in array

i would do it this way

sample_data var byte[32]
fail var bit
sample var byte
a_one var byte
a_zero var byte
13. ## Thread: Parsing commands and parameters

by richard
Replies
4
Views
306

### Re: Parsing commands and parameters

so a command is *99 or *9 or *09 [where 9 == a numeric digit]
and a parameter is 9 up to 999999

how do you signal that the command has been input and the parameter begins

i would be...

by richard
Replies
6
Views
485

where did you get that idea, it is very possible with the correct syntax

suggest a read of the manual re

Applying Offsets to Bits within a Variable or Register
15. ## Thread: Parsing commands and parameters

by richard
Replies
4
Views
306

### Re: Parsing commands and parameters

what is the biggest command sequence that will be input ?
how does the pic know when the input seq is complete ?

16. ## Thread: BH1750FVI sample code available?

by richard
Replies
14
Views
4,508

### Re: BH1750FVI sample code available?

its best to be correct for future reference , not all i2c devices are so forgiving
17. ## Thread: BH1750FVI sample code available?

by richard
Replies
14
Views
4,508

### Re: BH1750FVI sample code available?

as maybe but you are still incorrect , if you use a logic analyzer you will see the transaction ends abnormally

wrong way
correct way
i2cwrite ldta, lclk,...
18. ## Thread: BH1750FVI sample code available?

by richard
Replies
14
Views
4,508

### Re: BH1750FVI sample code available?

not in my view
19. ## Thread: My "Library" for ST7920 Graphical displays, works fine, but...

by richard
Replies
30
Views
2,441

### Re: My "Library" for ST7920 Graphical displays, works fine, but...

9x2x8 lcd "command delays" per text line is probably the worst delay
your snippet lacks that exact detail

the st7920 chip has a spi i/f that's a little faster and uses less pins too

there...
20. ## Thread: How to detect variable going below zero, without using PBPL ?

by richard
Replies
18
Views
1,161

### Re: How to detect variable going below zero, without using PBPL ?

its called two's compliment , no magic involved

https://en.wikipedia.org/wiki/Two%27s_complement
21. ## Thread: BH1750FVI sample code available?

by richard
Replies
14
Views
4,508

### Re: BH1750FVI sample code available?

each and every i2c command has incorrect syntax
22. ## Thread: How to detect variable going below zero, without using PBPL ?

by richard
Replies
18
Views
1,161

### Re: How to detect variable going below zero, without using PBPL ?

only if you interpret it incorrectly and ignore the sign bit

23. ## Thread: How to detect variable going below zero, without using PBPL ?

by richard
Replies
18
Views
1,161

### Re: How to detect variable going below zero, without using PBPL ?

what does get bad mean ?

24. ## Thread: How to detect variable going below zero, without using PBPL ?

by richard
Replies
18
Views
1,161

### Re: How to detect variable going below zero, without using PBPL ?

what have you tried ?
in what way does it not provide a correct result?

signed divides, multiplies and shifts need proper handling of the sign bit
otherwise as long as the vars match in type...

by richard
Replies
4
Views
324