{"id":2916,"date":"2010-06-03T16:16:22","date_gmt":"2010-06-03T20:16:22","guid":{"rendered":"https:\/\/example.com\/?postname=ft232r-rs232-to-usb-converter"},"modified":"2010-06-03T16:16:22","modified_gmt":"2010-06-03T20:16:22","slug":"ft232r-rs232-to-usb-converter","status":"publish","type":"post","link":"http:\/\/atomsofttech.com\/blog\/uncategorized\/ft232r-rs232-to-usb-converter\/","title":{"rendered":"FT232R RS232 to USB\u00a0Converter"},"content":{"rendered":"<p>Finally decided to make a PCB for this. I had the IC since last year heh&#8230; Installs fine an i see the LED light up on Sending data from PC to it&#8230; not tested yet. Once tested ill post schematic and code used to test it&#8230;<\/p>\n<p><a href=\"http:\/\/atomsoft.wordpress.com\/wp-content\/uploads\/2010\/06\/ft232r.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-361\" title=\"FT232R\" src=\"http:\/\/atomsoft.wordpress.com\/wp-content\/uploads\/2010\/06\/ft232r.jpg\" alt=\"\" width=\"450\" height=\"521\" srcset=\"http:\/\/atomsofttech.com\/blog\/wp-content\/uploads\/2010\/06\/ft232r.jpg 600w, http:\/\/atomsofttech.com\/blog\/wp-content\/uploads\/2010\/06\/ft232r-259x300.jpg 259w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p>Here is some code that seems to be working so far&#8230;.<\/p>\n<blockquote><p>\/* *****************************************************************************<br \/>\n;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n;\u00a0\u00a0\u00a0 Filename:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n;\u00a0\u00a0\u00a0 Date:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n;\u00a0\u00a0\u00a0 File Version: 001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n;\u00a0\u00a0\u00a0 Author:\u00a0\u00a0 Jason Lopez\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n;\u00a0\u00a0\u00a0 Company:\u00a0 AtomSoft\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n;***************************************************************************** *\/<\/p>\n<p>#include &lt;p18f2525.h&gt;<br \/>\n#include &lt;delays.h&gt;<br \/>\n#include &lt;string.h&gt;<\/p>\n<p>#pragma config OSC = INTIO67,PWRT = OFF,BOREN = OFF,WDT = OFF,PBADEN = OFF<\/p>\n<p>\/************************************<br \/>\nPrototypes<br \/>\n*************************************\/<br \/>\nvoid main(void);<br \/>\nvoid USART_Init(void);<br \/>\nvoid USART_vSendByte( unsigned char u8Data);<br \/>\nunsigned char USART_vReceiveByte(void);<br \/>\nvoid delayms( unsigned char t);<\/p>\n<p>\/************************************<br \/>\nDefinitions and Variables<br \/>\n*************************************\/<br \/>\n#define LEDON 0x11\/\/switch led on command<br \/>\n#define LEDOFF 0x22\/\/switch led off command<\/p>\n<p>\/************************************<br \/>\nMain<br \/>\n*************************************\/<br \/>\nvoid main(void){<br \/>\nunsigned char x;<br \/>\nOSCCON = 0x72;\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\/\/8MHz clock<br \/>\nwhile(!OSCCONbits.IOFS);\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\/\/wait for osc stable<\/p>\n<p>USART_Init();<\/p>\n<p>while(1){<br \/>\nfor(x=0;x&lt;10;x++){<br \/>\nUSART_vSendByte(0x30+x);<br \/>\ndelayms(100);<br \/>\n}<br \/>\nx = USART_vReceiveByte();<br \/>\nUSART_vSendByte(x);<br \/>\n}<br \/>\n}<\/p>\n<p>void USART_Init(void)<br \/>\n{<br \/>\nTRISCbits.TRISC7 = 1;\u00a0\u00a0 \u00a0\/\/SETUP UART<br \/>\nTXSTA = 0;<br \/>\nSPBRG = 103;\u00a0\u00a0\u00a0\u00a0 \/\/1200bps<\/p>\n<p>RCONbits.IPEN = 1;<br \/>\nIPR1bits.RCIP = 1; \/\/PRIORITY<\/p>\n<p>TXSTAbits.TXEN = 1;\u00a0 \/\/ENABLE TX<br \/>\nRCSTAbits.CREN = 1;\u00a0 \/\/ENABLE RX<br \/>\nRCSTAbits.SPEN = 1;\u00a0 \/\/ENABLE SERIAL PORT and PIN Config<\/p>\n<p>PIR1\u00a0\u00a0 = 0b00000000;<br \/>\nPIE1\u00a0\u00a0 = 0b00101000;<br \/>\nIPR1\u00a0\u00a0 = 0b00101000;<br \/>\n}<\/p>\n<p>void USART_vSendByte( unsigned char u8Data)<br \/>\n{<br \/>\n\/\/ Wait if a byte is being transmitted<br \/>\nwhile(!TXSTAbits.TRMT);<br \/>\n\/\/ Transmit data<br \/>\nTXREG = u8Data;<br \/>\n}<br \/>\nunsigned char USART_vReceiveByte(void)<br \/>\n{<br \/>\n\/\/ Wait until a byte has been received<br \/>\nwhile(!PIR1bits.RCIF);<br \/>\n\/\/ Return received data<br \/>\nreturn RCREG;<br \/>\n}<br \/>\nvoid delayms( unsigned char t)<br \/>\n{<br \/>\nunsigned char i;<br \/>\nfor(i=0;i&lt;t;i++)<br \/>\nDelay1KTCYx(2);<br \/>\n}<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Finally decided to make a PCB for this. I had the IC since last year heh&#8230; Installs fine an i see the LED light up on Sending data from PC to it&#8230; not tested yet. Once tested ill post schematic and code used to test it&#8230; Here is some code that seems to be working [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2916","post","type-post","status-publish","format-standard","hentry"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/posts\/2916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/comments?post=2916"}],"version-history":[{"count":0,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/posts\/2916\/revisions"}],"wp:attachment":[{"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/media?parent=2916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/categories?post=2916"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/tags?post=2916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}