CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

FT245BM

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Userrr



Joined: 09 Jul 2004
Posts: 40
Location: Europe

View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger

FT245BM
PostPosted: Tue Jun 14, 2005 12:17 pm     Reply with quote

Please answ. me can I use PSP in 18F452 for driving FT245BM
and how mutch speed I can get from it?

Maybe some source code for it?
valemike
Guest







PostPosted: Tue Jun 14, 2005 1:46 pm     Reply with quote

I did a search on google for "245BM" and "PIC". If your company is willing to pay, you can get a demo module:

http://www.ftdichip.com/Products/EvaluationKits/DIPModules.htm
valemike
Guest







PostPosted: Tue Jun 14, 2005 1:49 pm     Reply with quote

By the way, the demo module uses a PIC16F872 and it does have a 40pin DIP socket. All you have to do is plug in your own 18F452 after converting the demo code from 16F to 18F.
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

UART instead of PSP
PostPosted: Wed Jun 15, 2005 12:16 am     Reply with quote

FT245BM accepts serial 0-5V input, and it can work with PIC's UART. The datasheet for FT245BM says that it can comunicate at 3Mbaud at TTL levels. I have used the chip only at 100kbaud.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

Re: UART instead of PSP
PostPosted: Wed Jun 15, 2005 7:26 am     Reply with quote

kender wrote:
FT245BM accepts serial 0-5V input, and it can work with PIC's UART. The datasheet for FT245BM says that it can comunicate at 3Mbaud at TTL levels. I have used the chip only at 100kbaud.


I think you have confused the FT232BM with the FT245BM. The FT232BM is a UART to USB while the FT245BM is a 8-bit parallel bus to USB. Both parts can operate in a bit-banging mode at a reduced speed.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Jun 15, 2005 7:48 am     Reply with quote

You can write your own dirver fairly easly. I did.(but I can't share the code)
Take someones serial ring buffer example(IRQ Tx & Rx). You can modifly them to do the 8bit parallel. And again this will be IRQ driven and the pins you use for IRQ should be apparent once you read the spec sheet. Also, FTDI has many example schamatics that will get you started, and let you know how to tie off pins and which ones to use.
http://www.ftdichip.com/Documents/Schematics.htm
I use 245BM example and the 245-5vb.pdf as reference.
This is the 5V bus powered example.
Guest








PostPosted: Wed Jun 15, 2005 8:44 am     Reply with quote

Here is an extract of operational code from two different applications, one written in C showing how to output to the FT245 and one written in assembler inputting characters from the FT245. I did not have an example of inputting from the FT245 in C as it was not needed for the specific application.

Both examples used a combination of USB and serial UART driver - if the USB was active it was used, if not then the USART was used.

Code:


/* some initialisation code */
   //; initialise the I/O lines to the USB controller
   bit_set(USB_FLUSH);   //; initialise the flush FIFO pin
   bit_clear(USB_WR);     //; set default WR level
   bit_set(USB_RD);   //; set default RD level
/* end of initialisation code */



void console_putc(char TxChar)
/************************************************************************************************
;
; Subroutine console_putc
;
;   Stdout routine (BLOCKING) for putting characters to the console interface.
;
; On Exit:
;
; Calls: Console_serial_putc
;
; ***********************************************************************************************/
   {
   long counter = 65535;   // setup counter to prevent lockup on failure of USB

   //; test to determine if the USB device is active
   if (!bit_test(USB_PwrEn))
      {
      while ((counter!=0) && bit_test(USB_WRF))
         {
         counter--;
         }
      if (Counter)
         {
         DBus = TxChar;      //; write the character to the data bus
         bit_set(USB_WR);
         DBusDir = 0;      //; set data bus to output
         bit_clear(USB_WR);
         DBusDir = 0xff;      //; set data bus to input
         }
      else
         {
         // timeout waiting on USB
         Console_serial_putc(TxChar);
         }
      }
   else
      {
      //; not active, pass control to the async port code
      Console_serial_putc(TxChar);
      }
   }







void ServiceTxQConsole()
/************************************************************************************************
;
; Subroutine SrvTxQConsole
;
;   Polled Console serial output subroutine (NON-BLOCKING)
;   Transmits the next byte, if present, from the
;   Console transmit buffer to the Console
;   If the USB port is active, it is used, else the console Port is used
;
;   Returns immediately if no characters are pending
;   in the output buffer
;
;   If the output register is busy the routine returns
;   immediately
;
;
; Entry:
;   Tx_TailC   points to next character in buffer for transmission
;   Tx_HeadC   points to end of buffer
;
; Exit:
;
; Calls:
;
; ***********************************************************************************************/
   {
   //; test if there are any characters in the buffer to be processed
   if (Tx_TailC != Tx_HeadC)
      {
      //; test to determine if the USB device is active
      //; if not active pass control to the async port code
      if (Bit_test(!USB_PwrEn))
         {
         //; here if the USB port is active
         //; test if the device is free to transmit
         if (bit_test(!USB_WRF))
            {
            console_putc(Tx_BaseC[Tx_TailC]);
            Tx_TailC = (Tx_TailC + 1) % TxCQSize;
            }
         }
      else
         {
         // USB not active
         // check the status of the serial port to see if it is free
         if (bit_test(TXIFC))
            {
            console_putc(Tx_BaseC[Tx_TailC]);
            Tx_TailC = (Tx_TailC + 1) % TxCQSize;
            }
         }
      }
   }



; *************************************************************************
;
; Subroutine Srv_RxQIn
;
;   Basic polled RS232 Rx port input service subroutine (NON BLOCKING)
;   Services the USB controller if active, else services the asynchronous port
;   Received a byte from the Async Port and puts it in the Rx232 buffer
;
; Entry:
;   Rx_Head   points to next free location in RS232 receive buffer
;
; Exit:   
;   FSR2   destroyed
;   Read byte, if present is added to the receive buffer
;   Rx_Head point to next location in the ring buffer
;
; *************************************************************************
Srv_RxQIn

   ; test to determine if the USB device is active
   ; if not active pass control to the async port code
   btfsc   USB_PwrEn
   bra   SRQI_Async

   ; here if the USB port is active
   ; any characters present?
   btfsc   USB_RDF
   bra   SRQI_Async      ; no characters so check modem

   ; here we have a character in the USB controller
   ; Point FSR2 to the RS232 receive buffer
   movlw   high Rx_Base
   movwf   FSR2H
   movff   Rx_Head, FSR2L

   ; fetch it and add it to the receive buffer
   setf   DBusDir      ; set the data bus to input
   bcf   USB_RD
   nop
   movf   DBus, W
   bsf   USB_RD
   movwf   INDF2

   ; update the RS232 buffer head pointer
   incf   Rx_Head, F
   return
   
SRQI_Async
   ;..... RS232 UART handler follows....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group