| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| thiam 
 
 
 Joined: 06 Apr 2010
 Posts: 13
 
 
 
			    
 
 | 
			
				| Do anyone know the coding for UC00A UART-USB Converter? |  
				|  Posted: Tue Apr 06, 2010 11:40 am |   |  
				| 
 |  
				| Hi, I have no idea for the coding of  UC00A UART-USB Converter. the device can be bought from Cytron.. for more information about the device, pls refer to the website below.
 http://www.cytron.com.my/listProducts.php?actionURL=&txtSearch=UC00A
 Can someone guide me about the code for the device. I mean how to communiciate the PIC to PC through the device... Thank you!!
 |  | 
	
		|  | 
	
		| bkamen 
 
 
 Joined: 07 Jan 2004
 Posts: 1616
 Location: Central Illinois, USA
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 11:42 am |   |  
				| 
 |  
				| On the PC, what OS are you using? what does the application communicating with the PIC need to do? 
 What is the PIC doing? what kind of data does is send back?
 
 Is you PC application just data logging? Heck - you could script that..
 
 Or more?
 
 You haven't given any real information as what you need.
 
 -Ben
 _________________
 Dazed and confused? I don't think so. Just "plain lost" will do.  :D
 |  | 
	
		|  | 
	
		| FvM 
 
 
 Joined: 27 Aug 2008
 Posts: 2337
 Location: Germany
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 1:52 pm |   |  
				| 
 |  
				| The said converter uses a FTDI FT232 and ships with FTDI standard drivers. You can refer to the documentation provided by www.ftdichip.com and the discussion related to this device at CCS forum and allover the internet.
 |  | 
	
		|  | 
	
		| thiam 
 
 
 Joined: 06 Apr 2010
 Posts: 13
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 6:39 pm |   |  
				| 
 |  
				| The OS I'm using is Windows XP. Then I need to communicate the PIC with my computer by using that device. Since I have tried the Serial port RS232, the communicate between PIC and my PC is function well. I need a simple application only. For example, the pin_B6 will on when i send a char like '1' from my computer to PIC... So, can you guide me about that??? thanks. |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 8:17 pm |   |  
				| 
 |  
				| Your RS232 to USB adapter does not require any special programming. Use the program shown below on your PIC.  When you type a character
 in the terminal window on the PC, it will go to the PIC, and then the PIC
 will send it back to the terminal window.
 
 Make these 3 connections between the PIC board and the UC00A:
 
 1. Connect the Tx pin on the PIC to the Rx pin on the UC00A.
 
 2. Connect the Rx pin on the PIC to the Tx pin on the UC00A.
 
 3.  Connect the Ground pin on the PIC board to the Ground pin
 on the UC00A.
 
 
  	  | Code: |  	  | #include <16F877A.h>
 #fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
 #use delay(clock=20000000)
 #use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
 
 //=========================================
 void main()
 {
 char c;
 
 while(1)
 {
 c = getc();  // Get a character from the PC
 putc(c);  // Send the same character to the PC
 }
 
 }
 
 | 
 |  | 
	
		|  | 
	
		| bkamen 
 
 
 Joined: 07 Jan 2004
 Posts: 1616
 Location: Central Illinois, USA
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 8:35 pm |   |  
				| 
 |  
				| Doesn't he want to test with kbhit? (as below?) 
 
  	  | Code: |  	  | #include <16F877A.h>
 #fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
 #use delay(clock=20000000)
 #use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
 
 //=========================================
 void main()
 {
 char c;
 
 while(1)
 {
 if ( kbhit() ) {
 c = getc();  // Get a character from the PC
 putc(c);  // Send the same character to the PC
 }
 }
 }
 
 | 
 _________________
 Dazed and confused? I don't think so. Just "plain lost" will do.  :D
 |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 8:43 pm |   |  
				| 
 |  
				| getc() includes kbhit.   getc() waits for a key to be pressed.  Then it returns the value. |  | 
	
		|  | 
	
		| bkamen 
 
 
 Joined: 07 Jan 2004
 Posts: 1616
 Location: Central Illinois, USA
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 8:54 pm |   |  
				| 
 |  
				|  	  | PCM programmer wrote: |  	  | getc() includes kbhit.   getc() waits for a key to be pressed.  Then it returns the value. | 
 
 Oy - I've seen so many examples where kbhit() was needed.
 
 Hmm, Even still.. if getc does nothing, won't putc(c); in that example keep streaming the last value of c regardless of what getc does?
 
 -Ben
 _________________
 Dazed and confused? I don't think so. Just "plain lost" will do.  :D
 |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 8:56 pm |   |  
				| 
 |  
				| It doesn't do nothing.  It waits for a key to be pressed.  The program will not advance beyond the getc() line until a key is pressed.
 |  | 
	
		|  | 
	
		| bkamen 
 
 
 Joined: 07 Jan 2004
 Posts: 1616
 Location: Central Illinois, USA
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 9:32 pm |   |  
				| 
 |  
				| Dang. 
 That's pretty funny.
 
 I had seen so many examples of getc used with kbhit so long ago in the examples, I never actually looked at the help file for getc which indeed states:
 
 This function waits for a character to come in over the RS232 RCV pin and returns the character.   If you do not want to hang forever waiting for an incoming character use kbhit() to test for a character available.  If a built-in USART is used the hardware can buffer 3 characters otherwise GETC must be active while the character is being received by the PICĀ®.
 
 
 Learn something new every day.
 _________________
 Dazed and confused? I don't think so. Just "plain lost" will do.  :D
 |  | 
	
		|  | 
	
		| thiam 
 
 
 Joined: 06 Apr 2010
 Posts: 13
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 10:05 pm |   |  
				| 
 |  
				| Thanks for your advice and codes. I have tried for both codes. With serial port, the code with kbhit() has no problem, but the another code can't run. However, both of the codes cannot run by using UC00A converter. Is the code missing something to communiciate with UC00A converter? |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Apr 06, 2010 10:28 pm |   |  
				| 
 |  
				| Download the User's Manual for the UC00A: http://www.cytron.com.my/datasheet/PICStart-upKit/UC00A_User's_Manual.pdf
 Look on page 11.  It shows the Device Manager window for the Com Ports
 on the PC.   Find the Com Port which is assigned to the UC00A.
 In the example shown in the User's Guide, it has the extreme case of
 COM20 as the port.  Normally, it will not be such a high port number.
 
 Once you have learned the Com Port number for the UC00A, then go into
 the Com Port setup menu in your Terminal program and select the same
 Com Port.  For example, if you are using TeraTerm, the Com Port is
 selected in the Setup/General menu.   After you have selected the
 correct ComPort, the Terminal program can talk to the correct Com Port.
 It should now work.
 
 Of course, I assume that you also setup the correct baud rate in the
 Terminal program setup menu, so it's the same as the baud rate in
 your PIC program.
 |  | 
	
		|  | 
	
		| thiam 
 
 
 Joined: 06 Apr 2010
 Posts: 13
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Apr 07, 2010 12:17 am |   |  
				| 
 |  
				| Regarding to the port number, I have check and change. I have read the user manual. However, they just guide us to connect the UC00A to microcontroller. I have tried the code again after changing everything but still face the same problem. The signal from PC seems cannot transfer to microcontroller. Do you have any solution for it?? |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Apr 07, 2010 12:48 am |   |  
				| 
 |  
				| No.  I don't have anything more to say. |  | 
	
		|  | 
	
		| thiam 
 
 
 Joined: 06 Apr 2010
 Posts: 13
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Apr 07, 2010 2:11 am |   |  
				| 
 |  
				| ok.. never mind... any way.. thank you so much |  | 
	
		|  | 
	
		|  |