Search found 47 matches

by CrazyFrog112
Mon Jun 07, 2010 8:44 pm
Forum: Tricks 'n' Tips
Topic: I2C and a Dallas temperature sensor at the serial port
Replies: 5
Views: 2855

Re: I2C and a Dallas temperature sensor at the serial port

Or you can use this version ( the one I've built ). It powers directly from USB port and the component-list is smaller.
You can add up to 8 sensors in parallel-conection.

http://www.riccibitti.com/pc_therm/usb_pc_therm.gif

The project I'll be working in couple of weeks is for a thermometer ...
by CrazyFrog112
Mon Jun 07, 2010 11:43 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: [SOLVED] Problem translating VB6 to PB (serial port )

I got it . In the formula :

Code: Select all

 temperature.f = (temperature_int * 256 + temperature_frac) / 128 * 5 / 10
, first time, the (temperature_int * 256 + temperature_frac) is divided by 128, then the result is multiplied by 0.5

Code: Select all

( x / 128 ) * 0.5 = x / 64, because  x*0.5 means x/2
by CrazyFrog112
Mon Jun 07, 2010 11:30 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: [SOLVED] Problem translating VB6 to PB (serial port )

Here is my code result :

Serial Port Opened!
The Integer part is :23
The Fraction part is :96
Temperature is :23.375000


Here is your code result :

5984
23.375


I use the formula :

Debug "The Integer part is :" +Str(temperature_int)
Debug "The Fraction part is :" +Str(temperature_frac ...
by CrazyFrog112
Mon Jun 07, 2010 10:41 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: [SOLVED] Problem translating VB6 to PB (serial port )

Yes, it works, but you have tu use #PB_SerialPort_Nohandshake.

With #PB_SerialPort_RtsCtsHandshake it gives me 0.0
With #PB_SerialPort_NoHandshake it gives me :
5840
22.8125

This is the modified code, with #PB_SerialPort_NoHandshake
;
; DS1631 at a serial port
;


#StartConvertT = $51 ...
by CrazyFrog112
Mon Jun 07, 2010 10:02 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: [SOLVED] Problem translating VB6 to PB (serial port )

This is my working code :

Procedure.i open_iic_bus()
comport.s = "COM1"
gg= OpenSerialPort(0, comport, 9600, #PB_SerialPort_NoParity, 8, 1, #PB_SerialPort_NoHandshake, 1024, 512)



If gg
Debug "Serial Port Opened!"
Else
Debug "nooo"
EndIf
EndProcedure

Procedure close_iic_bus()
CloseSerialPort(0 ...
by CrazyFrog112
Mon Jun 07, 2010 9:58 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: [SOLVED] Problem translating VB6 to PB (serial port )

This is what it shows in both cases ( before and after the modification ) :

Code: Select all

65535
-0.00390625
65535
-0.00390625
65535
-0.00390625
65535
-0.00390625
65535
-0.00390625
by CrazyFrog112
Mon Jun 07, 2010 8:47 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: Problem translating VB6 to PB (serial port communication

Here is what the debug window "says" :

Serial Port Opened!
The Integer part is :22
The Fraction part is :208
Temperature is :22.812500
Serial Port Opened!
The Integer part is :22
The Fraction part is :208
Temperature is :22.812500
Serial Port Opened!
The Integer part is :22
The Fraction part is ...
by CrazyFrog112
Mon Jun 07, 2010 8:42 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: Problem translating VB6 to PB (serial port communication

Thanks, I got it, it works ! :lol: :wink:
The "If B & $80" was the fault
by CrazyFrog112
Mon Jun 07, 2010 8:37 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: Problem translating VB6 to PB (serial port communication

It's DS1631, I changed the value, acording to DS1631 Datasheet, so $51 is good.
by CrazyFrog112
Mon Jun 07, 2010 8:11 am
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: Problem translating VB6 to PB (serial port communication

I also think that this piece of code has to do with it :

Public Function IIC_tx_byte(ByVal B As Long) As Integer
Dim i As Integer
For i = 0 To 7
If (B And &H80) Then
IIC_tx_bit_1
Else
IIC_tx_bit_0
End If
B = B * 2
Next
IIC_tx_byte = IIC_rx_bit
End Function

the If (B And &H80 ) looks ...
by CrazyFrog112
Sun Jun 06, 2010 11:14 pm
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: Problem translating VB6 to PB (serial port communication

Yes, I agree, but the VB6 source code as I posted, works fine if I compile.
by CrazyFrog112
Sun Jun 06, 2010 10:19 pm
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: Problem translating VB6 to PB (serial port communication

With math in my code, yes, I get -246, but if I correct the brackets as in your example, i get -1.0. But the real temperature that the VB6 compiled program shows is 21.88 degrees.
by CrazyFrog112
Sun Jun 06, 2010 9:05 pm
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: Problem translating VB6 to PB (serial port communication

They are returning 255 , both of them
by CrazyFrog112
Sun Jun 06, 2010 8:42 pm
Forum: Coding Questions
Topic: [SOLVED] Problem translating VB6 to PB (serial port )
Replies: 29
Views: 6357

Re: Problem translating VB6 to PB (serial port communication

I tried both suggestions, and still nothing. I get -1.0 ( that means temperature_int = 255 and temperature_frac = 255 ).
Maybe is because how I opened the serial port.