Search found 273 matches

by jadiflow
Mon May 13, 2019 11:13 am
Forum: Bug reports
Topic: Workaround for fround(x,y) for PIC?
Replies: 7
Views: 7241

Re: Workaround for fround(x,y) for PIC?

Actually, it is much simpler ...
Just add 0.005 and display only 2 decimals. If the 3rd decimal is > 5, it automagically rolls over to 1.01, if not it remains 1.00 .

Jan
by jadiflow
Mon May 13, 2019 10:21 am
Forum: Bug reports
Topic: Workaround for fround(x,y) for PIC?
Replies: 7
Views: 7241

Re: Workaround for fround(x,y) for PIC?

This works, as noted, though feels awkward.

Jan
by jadiflow
Mon May 13, 2019 10:01 am
Forum: Bug reports
Topic: Workaround for fround(x,y) for PIC?
Replies: 7
Views: 7241

Re: Workaround for fround(x,y) for PIC?

Martin, I tried the attached, which should be equivalent to your example, but it does not give what I expected. With an initial value of 1.006 I expect a rounding to 1.01 but I am getting 1.00 . What am I missing?

Jan
by jadiflow
Mon May 13, 2019 9:39 am
Forum: Bug reports
Topic: Workaround for fround(x,y) for PIC?
Replies: 7
Views: 7241

Re: Workaround for fround(x,y) for PIC?

Thanks Martin, I'll try that. Certainly looks smarter than my method ;-)

Though I am new to the .mul etc format.

Jan
by jadiflow
Sun May 12, 2019 9:22 am
Forum: Bug reports
Topic: Workaround for fround(x,y) for PIC?
Replies: 7
Views: 7241

Workaround for fround(x,y) for PIC?

Hi, As it is known that the math function fround(x,y) doesn't work for the PIC family, I was wondering if anyone has a recommended workaround for it? What I do is convert the float to string, then look at a specific character to see if it is above 5 or not, and if so, add the round to the original n...
by jadiflow
Thu May 09, 2019 3:14 pm
Forum: Programming Tips & Tricks
Topic: Rounding String or Float Variables
Replies: 2
Views: 9235

Re: Rounding String or Float Variables

Can I add my vote that someone fixes this? fround(x,y) doesn't work, instead it work like round(). The floating point number is rounded to the next integer instead of actually rounded up. If it can't be fixed, maybe indicate in the help file that it doesn't work for PIC processors. Jan Didden Linear...
by jadiflow
Thu May 09, 2019 2:05 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Re: Wrong counts from 16F886 ADC? - work-around

Finally compiled the software to another PIC, a 16F1788. Same hardware prototype. This is a 12 bit ADC, so for a 1V input and 4.096 ref I should get a count of 1000, I get 997. Good enough for government work. Actually the ref is 4.102V so that narrows the gap further. Conclusions: - Nothing wrong w...
by jadiflow
Thu May 02, 2019 8:36 am
Forum: Flowcode V7
Topic: Error in EEPROM call
Replies: 4
Views: 3728

Re: Error in EEPROM call

Yes that fixed it, thanks Ben.

Jan
by jadiflow
Wed May 01, 2019 10:41 am
Forum: Flowcode V7
Topic: Error in EEPROM call
Replies: 4
Views: 3728

Re: Error in EEPROM call

Can anybody please tell me if the errors noted in the previous post are in my app or in the library files?

Thanks,

Jan
by jadiflow
Tue Apr 30, 2019 10:02 am
Forum: Flowcode V7
Topic: Error in EEPROM call
Replies: 4
Views: 3728

Re: Error in EEPROM call

I just changed the controller type from 18F25K42 to an 18F25K40 which has the same EEPROM location and same EEPROM size, and that compiles without errors. So it seems that the EEPROM library somehow has an error in the definition for the 18F25K42. Edit: tried 18F26K42, which can be selected but when...
by jadiflow
Mon Apr 29, 2019 7:21 pm
Forum: Flowcode V7
Topic: Error in EEPROM call
Replies: 4
Views: 3728

Error in EEPROM call

Out of frustration that I can't get the 16F886 ADC working correctly I decided to get another PIC and see if that works better. PIC18F25K42 has the same package and the same pin connections so completely functional and physical compatible. It even has a 12 bit ADC versus 10 bit for the 'F886. But no...
by jadiflow
Mon Apr 29, 2019 5:23 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Re: Wrong counts from ADC?

Set ADCON1 register bit 5 should switch the 0V ref to the '-Ref' pin. No change.
by jadiflow
Mon Apr 29, 2019 4:06 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Re: Wrong counts from ADC Q to Leigh

Hi Leigh, Flowcode offers me a selection of ADC ref voltages, either Vdd or 'Vref-pin'. However the chip itself also offers the selection of the 0V ref for the ADC, either Vss or the -Vref pin. I am returning the gnd of the voltage to be converted to this pin, but if the chip configuration has been ...
by jadiflow
Mon Apr 29, 2019 2:24 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Re: Wrong counts from ADC?

Hung a cap on that an9 pin, as well as a scope probe. See some switching noise but not more than +/-4mV peak.
by jadiflow
Mon Apr 29, 2019 1:56 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Re: Wrong counts from ADC?

Not clear what type of error it is: Vin exp.cnts act.cnts error 2.076 504 499 5 1% 1.499 375 363 12 3% 0.974 243 231 12 5% 0.497 124 115 9 7% I did experiment with the sample clock settings and the delay between sampling in the macro, but that doesn't seem to make any difference. Is there a recommen...
by jadiflow
Mon Apr 29, 2019 1:42 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Re: Wrong counts from ADC?

OK, went back and inserted 1.006V DC, on a 6.5 digit DMM, directly at the an9 pin on the pic, from a DC power supply. That does make a difference, count is now 243. Still 7 counts (28mV) missing.

Jan
by jadiflow
Mon Apr 29, 2019 1:26 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Re: Wrong counts from ADC?

Hi Leigh,

I looked at that earlier, the 1V comes from a very low Zout (0.5R nominal) from an RMS-DC converter (AD536), then into the PIC via 499R. Should be OK, no?

Jan
by jadiflow
Mon Apr 29, 2019 12:54 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Re: Wrong counts from ADC?

Did some further tests: Tried a different chip (same type), changed between ADC sample clock Focs/8 to Fosc/32. Also changed software to loop 8 times sampling integer, adding them all up then shift right 3 places. In all cases I see exactly the same result, 239/240/241 I changed the ADC read to Byte...
by jadiflow
Sat Apr 27, 2019 12:23 pm
Forum: Flowcode V7
Topic: Wrong counts from ADC?
Replies: 10
Views: 5679

Wrong counts from ADC?

Hello, I am using the AN9 ADC input on a PIC16F886 to read a DC voltage. For some reason, I don't get what I expect, so either I do something wrong or my expectation is wrong ;-) . Can anyone help? I am sending a DC voltage of 1.000VDC into pin 25. Reference is set to 'Ref+pin', that pin is at 4.102...
by jadiflow
Wed Apr 17, 2019 11:48 am
Forum: Flowcode V7
Topic: Saving signed integers in EEPROM?
Replies: 6
Views: 4466

Re: Saving signed integers in EEPROM?

Got it, thanks!

Jan
by jadiflow
Wed Apr 17, 2019 10:24 am
Forum: Flowcode V7
Topic: Saving signed integers in EEPROM?
Replies: 6
Views: 4466

Re: Saving signed integers in EEPROM?

Aha! So any INT higher than 255 I have to manipulate if I want to write it to EEPROM (on an 8 bit device). And although the macro asks for an INT address, it really can only address 256 locations then? Or does that not have that limitation?

That's OK though, that will work for me.

Jan
by jadiflow
Wed Apr 17, 2019 9:31 am
Forum: Flowcode V7
Topic: Saving signed integers in EEPROM?
Replies: 6
Views: 4466

Re: Saving signed integers in EEPROM?

Hi Martin, yes that surely does help, thanks. Looking at it again though, the EEPROM macro in FC7 seems to expect an INT for both the EEPROM address and the argument. Does that mean that it basically reads/writes 2-byte chunks (words) at the time, rather than bytes? The component properties says the...
by jadiflow
Wed Apr 17, 2019 8:21 am
Forum: Flowcode V7
Topic: Saving signed integers in EEPROM?
Replies: 6
Views: 4466

Saving signed integers in EEPROM?

Hi, I have a need to save/recall signed integers in EEPROM. Numbers are small, say between -50 and +50. The standard way to write to EEPROM is byte-based, and I add a number to each value at write, and subtract at read, to make sure they are always positive. But it is awkward and error-prone. Is the...
by jadiflow
Wed Mar 20, 2019 12:02 pm
Forum: 8-Bit PIC
Topic: How to remove peripheral? Solved!
Replies: 0
Views: 6326

How to remove peripheral? Solved!

Found it! I have a project with two EEPROMs attached in V7, an EEPROM (native FC7) and a 'V5_eeprom0' which came with the source developed in FC5. I suspect I have somewhere mixed up the two and want to remove one to find out. Probably a stupid question, but how do I remove a peripheral from being a...
by jadiflow
Mon Feb 25, 2019 1:35 pm
Forum: Flowcode V7
Topic: Small red cross on a variable - what does it mean?
Replies: 2
Views: 2474

Re: Small red cross on a variable - what does it mean?

Neat! Thanks Medelec!

Jan