Search found 316 matches

by nigelmercier
28 Nov 2016 13:36
Forum: mikroC PRO for PIC General
Topic: Using PICKIT3 with mikroC and mikroProg?
Replies: 2
Views: 1674

Re: Using PICKIT3 with mikroC and mikroProg?

Thank you for that. But how do the configuration bits get picked up?
by nigelmercier
28 Nov 2016 11:24
Forum: mikroC PRO for PIC General
Topic: Using PICKIT3 with mikroC and mikroProg?
Replies: 2
Views: 1674

Using PICKIT3 with mikroC and mikroProg?

A friend is using my mikroC code to program a PIC. He has a PICKIT3, what does he need to do to use this with mikroProg?
by nigelmercier
03 Oct 2016 13:16
Forum: mikroC PRO for PIC General
Topic: Equivalent of CHR$()
Replies: 5
Views: 2597

Re: Equivalent of CHR$()

Thank you, but I don't see how that helps.

I have a number representing an ASCII character, I want to pass that in a single character string.
by nigelmercier
02 Oct 2016 22:42
Forum: mikroC PRO for PIC General
Topic: Divide integer by 10 then display one decimal place?
Replies: 7
Views: 2928

Re: Divide integer by 10 then display one decimal place?

Because of the way strings (and arrays generally) work in C if you want a function to return a string (or array) it is far better to pass the string (really its pointer) to the function as a parameter and not try to return a string as a return value. By passing the string in to the function you ens...
by nigelmercier
02 Oct 2016 14:17
Forum: mikroC PRO for PIC General
Topic: Equivalent of CHR$()
Replies: 5
Views: 2597

Equivalent of CHR$()

I want to pass a single character string to a function where the value of the string is an ASCII value, I think this is the equivalent of CHR$() For example, the current function call uses a constant string: strFontLgeXY(">", 116, 4) ; // send ASCII 0x3E I want the equivalent of this: num = 0x3E ; s...
by nigelmercier
27 Sep 2016 22:08
Forum: mikroC PRO for PIC General
Topic: BMP180 Temperature Sensor mikroC
Replies: 15
Views: 11216

Re: BMP180 Temperature Sensor mikroC

Hi, There is a chance that the example project from LibStock has errors, because it is not official MikroElektronika example project, and therefore we can't provide detailed help for the code itself. But your problem is in the calculation. You can set Pa, hPa or mbar. 1 mbar = 1 hPa = 100 Pa Regard...
by nigelmercier
27 Sep 2016 11:18
Forum: mikroC PRO for PIC General
Topic: BMP180 Temperature Sensor mikroC
Replies: 15
Views: 11216

Re: BMP180 Temperature Sensor mikroC

Hi Nadir,

There is one thing still bugging me. The Bosch datasheet says that the true pressure is returned in Pa, so standard air pressure of 1013hPa should be a long integer of value 101300. I'm getting 10130.
by nigelmercier
27 Sep 2016 10:46
Forum: mikroC PRO for PIC General
Topic: Divide integer by 10 then display one decimal place?
Replies: 7
Views: 2928

Re: Divide integer by 10 then display one decimal place?

And here is the working version: char * intDiv10ToStr(int num) { // divide integer num by 10, return string (with sign) and 1 DP (12345 -> "1234.5") char txt9[9] = "-0000.0 " ; IntToStr(num , txt7 ) ; // txt7 now "s12345" memcpy(txt9, txt7, 5) ; // txt9 now "s1234.0 " memcpy(txt9 +6, txt7 +5, 1) ; /...
by nigelmercier
27 Sep 2016 09:59
Forum: mikroC PRO for PIC General
Topic: Divide integer by 10 then display one decimal place?
Replies: 7
Views: 2928

Re: Divide integer by 10 then display one decimal place?

I've decided to create a function to do this, at the moment it just returns a pre-defined string: char * intDiv10ToStr(int num) { // divide integer num by 10, return string (with sign) and 1 DP (12345 -> "s1234.5") char txt8[] = "01234.5" ; // empty function for testing ... return txt8 ; } Except th...
by nigelmercier
26 Sep 2016 16:39
Forum: mikroC PRO for PIC General
Topic: BMP180 Temperature Sensor mikroC
Replies: 15
Views: 11216

Re: BMP180 Temperature Sensor mikroC

nadir.celebic wrote:Did you solve the problem?
I need to double check against a calibrated source, but the readings now seem correct.

It does mean that the code on LibStock is faulty, when I've finished adjusting I'll zip some files up and upload them.
by nigelmercier
26 Sep 2016 14:22
Forum: mikroC PRO for PIC General
Topic: Divide integer by 10 then display one decimal place?
Replies: 7
Views: 2928

Divide integer by 10 then display one decimal place?

I have a number stored in a variable of type int, for example 10132

This actually represents an air pressure of 1013.2hPa, how can I convert this so it will display one decimal place?
by nigelmercier
25 Sep 2016 10:36
Forum: mikroC PRO for PIC General
Topic: BMP180 Temperature Sensor mikroC
Replies: 15
Views: 11216

Re: BMP180 Temperature Sensor mikroC

I may have fixed it.
My original code for final calculation of TrueP ...

Code: Select all

  TrueP = pp + ((X1 + X2 + 3791) >>4) ;   // pressure in Pa 101300
New code that gives more sensible result ...

Code: Select all

  TrueP = pp + (X1 + X2 + 3791) >>4 ;     // pressure in Pa 101300
by nigelmercier
24 Sep 2016 16:25
Forum: mikroC PRO for PIC General
Topic: BMP180 Temperature Sensor mikroC
Replies: 15
Views: 11216

Re: BMP180 Temperature Sensor mikroC

Can you please zip and send your whole modified project? Hi Nadir, [UPDATE #2] I may have fixed it, see next post. OK, I've used the data from the example in the Bosch data sheet (attached) to force the values to be the same as the example. According to the SparkFun BMP180_Breakout Arduino Library ...
by nigelmercier
22 Sep 2016 13:36
Forum: mikroProg™ programmer and debugger
Topic: mikroICD Error Resetting Debugger EP3 Buffer Transfer Error
Replies: 5
Views: 4435

Re: mikroICD Error Resetting Debugger EP3 Buffer Transfer Er

I seem to have made it work again by ticking "Power target MCU from programmer" before running the debugger.
by nigelmercier
22 Sep 2016 10:56
Forum: mikroC PRO for PIC General
Topic: BMP180 Temperature Sensor mikroC
Replies: 15
Views: 11216

Re: BMP180 Temperature Sensor mikroC

I've got this working, but not happy with the results from this code. Using the BMP085 Library for mikroC PRO for PIC the values returned are very odd. The returned temperature always takes the form x.9999... and the returned pressure varies by up to 1mB over a few seconds. Is it that hard to get a ...

Go to advanced search