Char test reversed

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
User avatar
Darrel Taylor
Posts: 29
Joined: Wed Oct 04, 2006 4:44 pm
Location: California

Char test reversed

Post by Darrel Taylor » Mon Oct 16, 2006 1:42 am

With this program...

Code: Select all

Include "usart.bas"

Const
    Char_A As Char = "A",
    Char_B As Char = "B"
    
SetBaudrate(br19200)

If Char_A = Char_B Then
    USART.Write("Char_A = Char_B = TRUE",13,10)
Else    
    USART.Write("Char_A = Char_B = FALSE",13,10)
EndIf

If Char_A <> Char_B Then
    USART.Write("Char_A <> Char_B = TRUE",13,10)
Else    
    USART.Write("Char_A <> Char_B = FALSE",13,10)
EndIf

DelayMS(1000)

End
I get this result...

Code: Select all

Char_A = Char_B = TRUE
Char_A <> Char_B = FALSE
Somethings backwards somewhere.
Best regards,
DT

User avatar
Darrel Taylor
Posts: 29
Joined: Wed Oct 04, 2006 4:44 pm
Location: California

Post by Darrel Taylor » Mon Oct 16, 2006 2:00 am

Just for additional information. This program works fine (Byte instead of Char)

Code: Select all

Include "usart.bas" 

Const 
    Char_A As Byte = "A", 
    Char_B As Byte = "B" 
    
SetBaudrate(br19200) 

If Char_A = Char_B Then 
    USART.Write("Char_A = Char_B = TRUE",13,10) 
Else    
    USART.Write("Char_A = Char_B = FALSE",13,10) 
EndIf 

If Char_A <> Char_B Then 
    USART.Write("Char_A <> Char_B = TRUE",13,10) 
Else    
    USART.Write("Char_A <> Char_B = FALSE",13,10) 
EndIf 

DelayMS(1000) 

End
Result =

Code: Select all

Char_A = Char_B = FALSE
Char_A <> Char_B = TRUE
Best regards,
DT

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Mon Oct 16, 2006 9:39 am

> Just for additional information. This program works
> fine (Byte instead of Char)

There was a problem with the typecasting, which has now been fixed. You can download the latest version (1.2.0.1) from here...

http://www.sfcompiler.co.uk/swordfish/d ... index.html

User avatar
Darrel Taylor
Posts: 29
Joined: Wed Oct 04, 2006 4:44 pm
Location: California

Post by Darrel Taylor » Mon Oct 16, 2006 12:47 pm

8) WOW 8)

Amazing response time. Now I can get back to my new module.

Thanks David !
Best regards,
DT

Post Reply