Shop OBEX P1 Docs P2 Docs Learn Events
Problem with transfert to FT245A FTDI — Parallax Forums

Problem with transfert to FT245A FTDI

Jean BrunetJean Brunet Posts: 10
edited 2005-02-28 19:47 in General Discussion
Hello,

mad.gif·I am a problem in my SX/B program.
I am write the same in assembly langage, and it walk.

I am write a page in french for the SX.
You can see my work at :
http://perso.wanadoo.fr/asnora/sx/sx.htm

Excuse me for my longer code, but·I am begginer in SX/B basic.
This routine, don't walk at read_USBturn.gif
The led refuse to light. smhair.gif
' =========================================================================
'
'·· File...... Test_USB.SXB
'·· Purpose... USB transmission
'·· Author.... Jean Brunet
'·· E-mail.... jean.brunet17@wanadoo.fr
'·· Started...
'·· Updated... 28/02/2005
'
' =========================================================================
'
' Program Description
'
'
' Communication with FT245AM FTDI chip
' read and write a byte, write a string on USB port

DEVICE········· SX28, OSCHS2, TURBO, STACKX, OPTIONX
FREQ··········· 50_000000
'
' IO Pins
'
RXF·VAR·ra.0· ' in
TXE·VAR·ra.1· ' in
WR·VAR·ra.2· ' out
RDe·VAR·ra.3· ' out
led·VAR·rc.0· ' out
PUSB·VAR·rb·'in/out
'
' Constants
'

'
' Variables
'
dt·VAR·Byte
reg·VAR·Bit
idx·VAR·Byte
string·VAR·Byte
Msg·VAR·Byte
rtnAddr·VAR·Byte
' =========================================================================
· PROGRAM Start
' =========================================================================
Msge:
·DATA··· "A",13,0·'0
·DATA··· "B",13,0·'3
·DATA·· "ABC",13,0·'6
Start:
· TRIS_A = %0011
· TRIS_B = %11111111····'
· TRIS_C = %00000000
· Low led
'
' Program Code
'
main:

··GOSUB·read_USB,dt
··IF·reg=0 THEN main
··dt=dt & %00000011
··BRANCH dt, null, yes, no, three
null:
··GOTO· main

yes:
··GOSUB·write_string,0
··HIGH·Led
··GOTO·main
no:
··GOSUB·write_string,3
··LOW·Led
··GOTO·main
three:
··GOSUB·write_string,6
··GOTO·main

'
' Subroutines
'
' **************************************************************************
' write a string on port B
' **************************************************************************
write_string:
·idx = __PARAM1
loop:·········································
· ·READ Msge + idx, string················
· ·INC idx
· ·IF string = 0 THEN Fine
· ·GOSUB ·write_USB,string
·GOTO·loop
Fine:
·RETURN·

' **************************************************************************
' read a byte on port B
' **************************************************************************

read_USB:
·rtnAddr=__PARAM1
·reg=0
·IF RXF = 1 Then Fin
·LOW·RDe
·PAUSEUS 1
·__RAM(rtnAddr) = PUSB
·HIGH·RDe
·reg=1
Fin:
·RETURN

' **************************************************************************
' write a byte on port B
' **************************************************************************
write_USB:
··dt=__PARAM1
Att:
··IF TXE = 1 Then Att
··TRIS_B = %00000000
··PAUSEUS·1
··PUSB = dt
··PAUSEUS 1
··HIGH·WR
··PAUSEUS 2
··LOW·WR
··TRIS_B = %11111111
··RETURN
end
Thank you for your "patience"
Jean

Comments

  • BeanBean Posts: 8,129
    edited 2005-02-28 18:07
    Try changing "GOSUB read_USB,dt" to "GOSUB read_USB,@dt"

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com
    ·
  • Jean BrunetJean Brunet Posts: 10
    edited 2005-02-28 18:52
    Thanks Bean

    Now, my led put ON and OFF.

    I research if a member who have experience of the RAVAR module with XP.
    My transmission PC -> RAVAR is correct.
    The RAVAR -> PC tell me the number of the write string, but not the possibility to read the string.
    I am also an I/O error on the PC.

    The RAVAR module is USB 1.1 and my PC is USB 2.0. Compatibility is done ?

    http://perso.wanadoo.fr/asnora/sx/sx.htm
    Jean
  • BeanBean Posts: 8,129
    edited 2005-02-28 19:47
    Sorry, I have no experience with any of the USB stuff.
    Maybe someone else can help with that ?
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com
    ·
Sign In or Register to comment.