Convert ASCI String to Binary

Antworten
abacom
Site Admin
Beiträge: 3917
Registriert: Dienstag 23. September 2008, 10:54
Kontaktdaten:

Convert ASCI String to Binary

Beitrag von abacom » Montag 13. Oktober 2008, 14:16

p.erasmus



Anmeldungsdatum: 15.01.2007
Beiträge: 85

Verfasst am: 31.01.2008 23:10 Titel: Convert ASCI String to Binary

--------------------------------------------------------------------------------

Dear Abacom and users.
I have an application where I read 3 position hall sensors on a BLDC motor, the value of the 3 hall sensors range between 1 and 6
I send this value succesfully to PL over the serial port as a String and
then convert it to a Value again in PL however I would like to convert the value to a Binary value and use each bit position as a in put to the logic analyser ,by doing this I could then see the state of each hall sensor.
I could not find any Binary conversion function the A/D block function is of no use here as I can not convert the decimal value as a range of 0 to 5V which give a binary range of 256 (8bit mode)
Please help with some ideas
Thank you Peter
_________________
P.Erasmus
Automotive Engineering
http://www.wenko.ch
Switzerland

Nach oben


Mike D



Anmeldungsdatum: 03.07.2006
Beiträge: 236

Verfasst am: 01.02.2008 11:10 Titel:

--------------------------------------------------------------------------------

why can't you use the A/D-Converter?
Please explain it more specified.

Mike

Nach oben


abacom
Site Admin


Anmeldungsdatum: 30.06.2006
Beiträge: 898

Verfasst am: 01.02.2008 12:20 Titel:

--------------------------------------------------------------------------------

Yes please, I also don´t understand the problem.

Nach oben


p.erasmus



Anmeldungsdatum: 15.01.2007
Beiträge: 85

Verfasst am: 01.02.2008 13:05 Titel:

--------------------------------------------------------------------------------

I came right thank you
_________________
P.Erasmus
Automotive Engineering
http://www.wenko.ch
Switzerland

Nach oben


p.erasmus



Anmeldungsdatum: 15.01.2007
Beiträge: 85

Verfasst am: 01.02.2008 21:42 Titel:

--------------------------------------------------------------------------------

Dear Abacom and MikeD

To answer the question

The Hallsensor value is already in the digital domain
where Hall value decimal 5 == Binary in 8 bit mode 00000101if I use the A/D converter set at the range 0-5 with 8bit resolution then
5 is ==1111111 which is not the representation of the hallsensor positions
but the full 5V of the A/D which give the FF which is correct for the AD but but not for the direct Decimal to Binary conversion ,(try it convert decimal 5 to its binary equivalent with the A/D)
I came right but using labview have no other choice need the application to carry on with development work .

Best Regards
Peter
_________________
P.Erasmus
Automotive Engineering
http://www.wenko.ch
Switzerland

Nach oben


Mike D



Anmeldungsdatum: 03.07.2006
Beiträge: 236

Verfasst am: 02.02.2008 08:48 Titel:

--------------------------------------------------------------------------------

Hi
set the range from 0 to 255 in 8-bit ore 0 to 7 in 3-bit mode.

Mike

Nach oben


p.erasmus



Anmeldungsdatum: 15.01.2007
Beiträge: 85

Verfasst am: 02.02.2008 13:00 Titel:

--------------------------------------------------------------------------------

Hallo MikeD

Thank you very much I did it as you explained and it is working fine
no where in the documentation it shows that you can make the range a digital range it only shows that an analog value will be converted

Your help is really appreciated

Best Regards
Peter
_________________
ABACOM support

Antworten

Zurück zu „STRING-Verarbeitung“