CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

FLASH ON LCD AND MEASUREMENT ERROR

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








FLASH ON LCD AND MEASUREMENT ERROR
PostPosted: Thu Jun 10, 2004 3:57 am     Reply with quote

On 16F877, I have a printf command given below.

float value_o, akim_s ,value_i ;
.....
printf(lcd_putc, "VI:%3ld VO:%3ld A:%3ld " ,(long)value_i, (long)value_o, (long)akim_s);


I MEASURE PLUG (LINE) VOLTAGE USING MEANVALUE FOR 50 PERIODS AND SEND IT TO LCD WITH TWO LINES. (20X2, HITACHI)

BUT, THERE IS A FLASHING ON THE LCD WITHOUT ANY REASON.
FOR INSTANCE, I READ '219' VOLTS CORRESPONSING TO LINE VOLTAGE AND THEN '7' VOLTS (! ) IN TURN OF 219-7, 218-7, 218-8....etc. ON LCD.


OBVIOUSLY, LINE VOLTAGE IS RECTIFIED AS FULLWAVE THAN APPLIED TO ONE OF THE ANALOG INPUTS OF PIC16F877. I USE THIS VALUE LATER FOR SOME PURPOSES.

(1.11) COEFFICIENT FOR FULLWAVE RECTIFIED SINEWAVE IS MULTIPLIED BEFORE PRINTF COMMENT.

ADDIONALLY, IT IS CALIBRATED BY A DIGITAL VOLTMETER (WITH THE VALUE ON LCD) .
BUT, IF THE LINE LINE VOLTAGE IS CHANGED, THEY ARE DIFFERATING AT ANOTHER VOLTAGE ABOUT %5-6


WHAT IS WRONG WITH MY PRINT COMMAND?

THANKS A LOT ANYBODY WHO WILL HELP .


HUNDIL
Ttelmah
Guest







Re: FLASH ON LCD AND MEASUREMENT ERROR
PostPosted: Thu Jun 10, 2004 5:06 am     Reply with quote

Anonymous wrote:
On 16F877, I have a printf command given below.

float value_o, akim_s ,value_i ;
.....
printf(lcd_putc, "VI:%3ld VO:%3ld A:%3ld " ,(long)value_i, (long)value_o, (long)akim_s);


I MEASURE PLUG (LINE) VOLTAGE USING MEANVALUE FOR 50 PERIODS AND SEND IT TO LCD WITH TWO LINES. (20X2, HITACHI)

BUT, THERE IS A FLASHING ON THE LCD WITHOUT ANY REASON.
FOR INSTANCE, I READ '219' VOLTS CORRESPONSING TO LINE VOLTAGE AND THEN '7' VOLTS (! ) IN TURN OF 219-7, 218-7, 218-8....etc. ON LCD.


OBVIOUSLY, LINE VOLTAGE IS RECTIFIED AS FULLWAVE THAN APPLIED TO ONE OF THE ANALOG INPUTS OF PIC16F877. I USE THIS VALUE LATER FOR SOME PURPOSES.

(1.11) COEFFICIENT FOR FULLWAVE RECTIFIED SINEWAVE IS MULTIPLIED BEFORE PRINTF COMMENT.

ADDIONALLY, IT IS CALIBRATED BY A DIGITAL VOLTMETER (WITH THE VALUE ON LCD) .
BUT, IF THE LINE LINE VOLTAGE IS CHANGED, THEY ARE DIFFERATING AT ANOTHER VOLTAGE ABOUT %5-6


WHAT IS WRONG WITH MY PRINT COMMAND?

THANKS A LOT ANYBODY WHO WILL HELP .


HUNDIL


Firstly, STOP SHOUTING.
Find the 'caps lock' key, and stop using upper case all the time. It is generally considered quite rude to send all UC posts.

There is probably nothing wrong with your printf...
You don't show enough of the program to know, but the most likely thing, is that something else is being called, or this is being called a second time, with the wrong value. Try the expedient of simplifying things, just displaying a counter, and ensuring that the loop is not called more often than is needed, and see if you can isolate what is happening.
You describe the line voltage as being rectified, then applied to the chip. Presumably there is a divider resistor 'chain' involved, since otherwise the input would be destroyed. The second problem suggests that the output impedance of this chain is not low enough. The AD converter on the PIC, connects the incoming voltage to a capacitor (when you select the particular channel), and this capacitor then charges. The reading is taken from the voltage on the capacitor, not the incoming voltage as such. Having too low a drive impedance, can result in the behaviour becoming non-linear, or being influenced by the last voltage that was connected. Generally, if you want good accuracy, the voltage needs to either be buffered using an op-amp, or have fairly low value resistors used.
I'd suggest looking carefully at how the hardware here is organised, and then if you still have problems, post more of the code, so we can see what is happening.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group