Discussion in "PIC Microcontroller Discussion" started by    norms    Feb 16, 2008.
Sat Feb 16 2008, 11:44 pm
#11


Do you mean something like this:


GioppY




can you teach mo how? like to ask for your code on that... please
Sun Feb 17 2008, 12:57 am
#12
Hi.
I have attached the vb6 source code and the exe.
It communicate by one of the available com port on your pc @ 2400 baud,n,8,1
It wait for a string in the following format xx,xCR (CR means carriage return) where xx,x is a numeric value in the 00,0 to 19,9 range (please note the comma).
When receive the string it display the value (the string as received) and plot a graphic representation; after 128 samples the plot is erased and restarted.
It wait for a string every second; i do not know if it can handle higher sample rate.
Obviously you have to modify the code for your requirement.
Regards
Gianni
P.S.
220v ??? I hope that you use a transformer to REDUCE and ISOLATE the mains from the pic and from the pc
Attachment
Sun Feb 17 2008, 01:09 am
#13
thanks... yup i am using a transformer to step down the voltage then have some declarations equating 220=2.5 volts... thank you very much...
Sun Feb 17 2008, 11:55 am
#14


Hi.
I have attached the vb6 source code and the exe.
It communicate by one of the available com port on your pc @ 2400 baud,n,8,1
It wait for a string in the following format xx,xCR (CR means carriage return) where xx,x is a numeric value in the 00,0 to 19,9 range (please note the comma).
When receive the string it display the value (the string as received) and plot a graphic representation; after 128 samples the plot is erased and restarted.
It wait for a string every second; i do not know if it can handle higher sample rate.
Obviously you have to modify the code for your requirement.
Regards
Gianni
P.S.
220v ??? I hope that you use a transformer to REDUCE and ISOLATE the mains from the pic and from the pc

Attachment

GioppY



Gioppy can you check my c program for microcontroller if its correct? thanks
Sun Feb 17 2008, 09:26 pm
#15
Sorry! I do not know C language. I use picbasic.
Regards
Sun Feb 17 2008, 11:40 pm
#16
@Norms
Can you explain your project in some detail(mainly the algo)....
As for the C program some things look suspect.....
norms = (( 2.5 *1023)/5);

Now why would you do that?Why not simply 'norms=511',which is the value you get from that computation.
And what is 'volts_out'?Are you reading in some value from the serial port?
else if(volts_out==get_adc)

You haven't initialised get_adc,so you're in effect comparing volts_out to garbage.
Mon Feb 18 2008, 02:44 pm
#17
volts_out is the value read from the output of the load... its not from the serial port... hehehe, i just want to show the computation so any man know how i get the 511 value... so is the program ok?
Mon Feb 18 2008, 10:54 pm
#18
Except for get_adc value rest seems ok.
btw what is the get_adc for?
Tue Feb 19 2008, 03:54 pm
#19
its for getting the reading from the load... like the decimal value and as well as the digital value...
Fri Feb 22 2008, 12:26 pm
#20
heres my vb code: please and kindly check it. thanks

Private Sub CmdExit_Click()
    If MSComm1.PortOpen = True Then
    MSComm1.PortOpen = False
    End If
        End
End Sub
Private Sub Form_Load()
    MSComm1.InputLen = 0
    MSComm1.CommPort = 1
    MSComm1.Settings = "2400,N,8,1"
End Sub
Private Sub Timer1_Timer()
    Dim BytesToRead As Integer
    Dim norms As Variant
    MSComm1.PortOpen = True
    BytesToRead = 1
    Do
        DoEvents
        Loop Until MSComm1.InBufferCount = BytesToRead
        norms = MSComm1.Input
        Text1.Text = (((Asc(norms) * 0.01) * 230) / 2.5) & " Volts AC"
        MSComm1.PortOpen = False
End Sub


[ Edited Fri Feb 22 2008, 10:26 pm ]

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

AntoniaRoons
Fri Apr 19 2024, 09:59 pm
carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am