In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Jean Brunet wrote: Yes, The program is a driver for the FT245R ship. The PC get "1" and the sx put a $0B response. At the second main loop, the ra port have a persistent information $0B. For testing the program, set rb.0, rb.2 and ra.0 At the first, the program loop at read_usb. clear rb.0, and for write_usb clear rb.2 Look ra port. The sx write $OB, and at the second read_usb the ra port are not refresh. The result is $Ob, not 1. Jean DEVICE SX28,OSCHS3 DEVICE turbo,STACKX, OPTIONX IRC_CAL IRC_FAST ID 'CCD02' ;program ID label RESET reset_entry ;set reset/boot address FREQ 50_000_000 RXF = rb.0 ; in. inv URD = rb.1 ; out. inv TXE = rb.2 ; in. inv WR = rb.3 ; out org 08H temp ds 1 data ds 1 reset_entry MOV M,#$0F MOV !RA,#%1111 ; Place le port A en entrée/sortie MOV !RB,#%01000101 ; Place le port B en entrée/sortie mov rb,#%00000010 MOV !RC,#%00000000 ; Place le port C en sortie setb RD ; CLR RB CLR fsr ; Efface la mémoire vive du SX :loop SB fsr.4 SETB fsr.3 CLR ind IJNZ fsr,:loop main call @read_USB mov w,data and w,#%00001111 jmp pc+w jmp main ; si 0 le SX ne répond pas jmp command command ; test réponse du SX28 mov w,#$0B call @write_USB jmp main org $200 ; ************************************************************************** ; lecture de 8 bits sur le port USB par le SX ; ************************************************************************** read_USB ; clr Sdata :att snb RXF ; rxf = 0, la FIFO est prête jmp :att clrb URD nop nop mov data,ra ; lecture port a nop nop setb URD :fin retp ; ************************************************************************** ; écriture sur le port 8 bits de l' USB ; ************************************************************************** write_USB mov data,w ; data sur le port B :att snb TXE ; si TXE = true, attente jmp :att mov temp,m ; mov m,#$0F mov !ra,#%0000 ; ra en écriture mov m,temp mov ra,data ; data sur le port C nop nop nop setb WR nop nop nop clrb WR mov temp,m mov m,#$0F mov !ra,#%1111 ; ra en lecture mov m,temp mov data,#0 retp end ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=153714#m153911 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)