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

3 digits Digital volt meter
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

3 digits Digital volt meter
PostPosted: Fri Mar 02, 2012 11:45 am     Reply with quote

Whats wrong with me. This code i was found from http://coolcircuit.com/project/meter/index.html
its code as ...
Code:
/*        voltmeter For 0 volt to 300 volt link are as

http://coolcircuit.com/project/meter/index.html
          Shivendra Sahu       
        16F676 Configuration   
          O = Output, I = Input
                             _________
                       vdd   | 1  14 |  Vss
for 1 (0)1ST_DISPLY--> RA5   | 2  13 |  AN0 <-- Sense_Value (I)
      (O)  SEG_(G) <-- RA4   | 3  12 |  AN1 --> 3RD_DISPLY (0) for 100
               N\C    MCLR   | 4  11 |  RA2 --> 2ND_DISPLY (0) for 10
      (O)  SEG_(F) <-- RC5   | 5  10 |  RC0 --> SEG_(A) (O)
      (O)  SEG_(E) <-- RC4   | 6   9 |  RC1 --> SEG_(B) (O)
      (O)  SEG_(D) <-- RC3   | 7   8 |  RC2 --> SEG_(C) (O)
                             ---------
*/
#include <16F676.h>
#device adc=10
#fuses INTRC_IO,NOWDT,PUT,NOPROTECT,BROWNOUT,NOMCLR
#use delay (clock=4000000) // 4MHz clock

#rom  0x3ff={0x3444}

#byte PORTA = 0x05
#byte PORTC = 0x07
#byte TRISA = 0x85
#byte TRISC = 0x87

#define SPORTA PORTA
#define SPORTC PORTC

#define  TICKS_BETWEEN_INTERRUPTS      5000 //5000
#define  INTERRUPT_OVERHEAD            35
#define  TMR1RESET (0xFFFF-(TICKS_BETWEEN_INTERRUPTS-INTERRUPT_OVERHEAD))


//// segment activates on LOW state of pins.
//const char SegCode[11] = {0x40,0x57,0x22,0x06,0x15,0x0C,0x08,0x56,0x00,0x04,0xFF};//for



_________________
sahu


Last edited by sahu77 on Wed Feb 12, 2014 2:15 pm; edited 1 time in total
temtronic



Joined: 01 Jul 2010
Posts: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Mar 02, 2012 12:27 pm     Reply with quote

what's right ???

does the ADC section work right ??

does the display section work right ?

does the PIC setup section work right ??


honestly I can see 23 things 'wrong' with the code as presented...
.., or do you just want it 'working right '???
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Fri Mar 02, 2012 12:43 pm     Reply with quote

temtronic wrote:
what's right ???

does the ADC section work right ??

does the display section work right ?

does the PIC setup section work right ??


honestly I can see 23 things 'wrong' with the code as presented...
.., or do you just want it 'working right '???


display section not work right.
this is right
Code:
const char SegCode[11] = {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0xFF};//for my vm
   //                       0    1    2    3    4    5    6    7    8    9
/* CA display (common anode) for  my vm
        A
        --
      F|G |B                0=ON
        --
      E|  |C                1=OFF
        --
        D                 
  A  B  C  D  E  F  G             = in order
  c0 c1 c2 c3 c4 c5 A4           =   A4 c5 c4 c3 c2 c1 c0       =  HEX CODE  = DECIMAL
  0  0  0   0  0 0  1             =  1  0  0  0  0  0  0        =  0X40      = 0

  1  0  0   1  1 1  1             =  1  1  1  1  0  0  1        =  0x79      = 1

  0  0  1   0  0 1  0             =  0  1  0  0  1  0  0        =  0x24      = 2

  0  0  0   0  1 1  0             =  0  1  1  0  0  0  0        =  0x30      = 3

  1  0  0   1  1 0  0             =  0  0  1  1  0  0  1        =  0x19      = 4

  0  1  0   0  1 0  0             =  0  0  1  0  0  1  0        =  0x12      = 5

  0  1  0   0  0 0  0             =  0  0  0  0  0  1  0        =  0x02      = 6

  0  0  0   1  1 1  1             =  1  1  1  1  0  0  0        =  0x78      = 7

  0  0  0   0  0 0  0             =  0  0  0  0  0  0  0        =  0x00      = 8

  0  0  0   0  1 0  0             =  0  0  1  0  0  0  0        =  0x10      = 9
  1  1  1   1  1 1  0             =  1  1  1  1  1  1  1        =  0xFF      = - */
const char Column[3]   = {0x06,0x03,0x02};  // may be as use \\(RA1= 0x02),(RA2= 0x04),(RA5=

0x32) my vm

_________________
sahu
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Fri Mar 02, 2012 1:24 pm     Reply with quote

OK, so what does it do/not do?\
- the characters display wrong? If so, which ones? How are they wrong?
- None of the digits work?
- Parts of the digits work? If so, which ones
- All of the digits work but they flicker?
- Or something else?
_________________
Google and Forum Search are some of your best tools!!!!
temtronic



Joined: 01 Jul 2010
Posts: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Mar 02, 2012 3:05 pm     Reply with quote

basic debugging101 says to try 1 digit at a time and cycle from 0 to 9.

record the results compare to desired response.

cut code to test each segment of each display.....

these 'test' programs should have been executed and confirmed before trying a 'digital voltmeter'.

standard 'post' procedure would be to cycle each segment of each display to confirm LEDs are 100% operational..
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

You are asking the wrong questions!
PostPosted: Fri Mar 02, 2012 4:21 pm     Reply with quote

sahu77.

You're doing it again

You are making it very difficult for us. You are making us work out what your problem is.

Please try to make it easier.

Have you got real hardware in front of you?
What can you see?
What is your hardware doing that it should not do?
What do you expect your hardware to do that is missing?

Supply your compiler version and a short compilable code snippet which demonstrates your problem.

Read the CCS guidelines.

Mike
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 11:27 am     Reply with quote

temtronic wrote:
basic debugging101 says to try 1 digit at a time and cycle from 0 to 9.

record the results compare to desired response.

cut code to test each segment of each display.....

these 'test' programs should have been executed and confirmed before trying a 'digital voltmeter'.

standard 'post' procedure would be to cycle each segment of each display to confirm LEDs are 100% operational..

I'm 100% suare my each display operational .
its not shown ADC value on 7 segments .
_________________
sahu
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 12:08 pm     Reply with quote

You are going to have a big problem in the real world if you don't learn to debug these kinds of issues. You need to create test routines that allow you to demonstrate the problem (or find the problem) in as simple a routine as it takes. Create a simple counter that updates every second - display the results - does it count right? Is it displaying the digits correct? You are "100% sure your display is right" --EXCEPT you are not seeing the expected results. You need to find why the results are not as expected - "I know it's right" isn't the correct answer. Verify it is working as expected. Then verify you are reading the ADC correctly, etc.
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
temtronic



Joined: 01 Jul 2010
Posts: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 12:51 pm     Reply with quote

You have to 'break' apart your program to debug.
Instead of reading the ADC 20 times, avg, etc. simply put in a 'dummy' value of say 123 and see what is displayed.
IF you get 123 on display
THEN you have an ADC section problem
ELSE you have a display problem.

IF you have an ADC problem
THEN confirm the Vin to ADC is correct
ELSE repair/rewire ADC section as required

IF you have a display problem
THEN confirm all wiring/LEDS/code is correct
ELSE repair/rewire as required OR recode as required

This is all 'basic debugging101'.

hth
jay
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 2:45 pm     Reply with quote

temtronic wrote:
You have to 'break' apart your program to debug.
Instead of reading the ADC 20 times, avg, etc. simply put in a 'dummy' value of say 123 and see what is displayed.
IF you get 123 on display
THEN you have an ADC section problem
ELSE you have a display problem.

IF you have an ADC problem
THEN confirm the Vin to ADC is correct
ELSE repair/rewire ADC section as required

IF you have a display problem
THEN confirm all wiring/LEDS/code is correct
ELSE repair/rewire as required OR recode as required

This is all 'basic debugging101'.

hth
jay


no no sir
problem is not this.
problem is in digit display .
like 123
its not show properly.
_________________
sahu
temtronic



Joined: 01 Jul 2010
Posts: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 3:29 pm     Reply with quote

OK, the display section isn't correct.
simply cut code to display 000-999 at a 1/2Hz rate and record what you get to say a spreadsheet,or just write down the results on paper.
Even doing just 0-9 should show the problem.
I can't help you further without knowing what the results are.What is needed is a chart of input vs output(ie: input a '1' , but display shows 'E', '2' shows 'C', etc.

hth
jay
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 3:31 pm     Reply with quote

sahu77 wrote:
no no sir
problem is not this.
problem is in digit display .
like 123
its not show properly.
After nearly two years you still don't get it.

YOU have to tell us CLEARLY what's wrong, THEN we can help you.

Tell us EXACTLY what you can see on the display and what you expect, with a short complete compilable code we can all copy&paste to test.

Mike
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 3:32 pm     Reply with quote

temtronic wrote:
OK, the display section isn't correct.
simply cut code to display 000-999 at a 1/2Hz rate and record what you get to say a spreadsheet,or just write down the results on paper.
Even doing just 0-9 should show the problem.
I can't help you further without knowing what the results are.What is needed is a chart of input vs output(ie: input a '1' , but display shows 'E', '2' shows 'C', etc.

hth
jay

pl give 1 exp. code.
Bcoz I'm very confused.
_________________
sahu
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 3:42 pm     Reply with quote

Mike Walne wrote:
sahu77 wrote:
no no sir
problem is not this.
problem is in digit display .
like 123
its not show properly.
After nearly two years you still don't get it.

YOU have to tell us CLEARLY what's wrong, THEN we can help you.

Tell us EXACTLY what you can see on the display and what you expect, with a short complete compilable code we can all copy&paste to test.

Mike

I wire 16f676 as

O = Output, I = Input
_________
vdd | 1
14 | Vss
for 1 (0)1ST_DISPLY--> RA5 | 2 13
| AN0 <-- Sense_Value (I)
(O) SEG_(G) <-- RA4 | 3 12
| AN1 --> 3RD_DISPLY (0) for 100
N\C MCLR | 4 11
| RA2 --> 2ND_DISPLY (0) for 10
(O) SEG_(F) <-- RC5 | 5 10
| RC0 --> SEG_(A) (O)
(O) SEG_(E) <-- RC4 | 6
9 | RC1 --> SEG_(B) (O)
(O) SEG_(D) <-- RC3 | 7
8 | RC2 --> SEG_(C) (O)
---------
*/

read ADC value with an0 .
_________________
sahu
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Fri Jan 17, 2014 3:50 pm     Reply with quote

Answer the question.

Mike

PS We are all really trying to help you.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
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