- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
For a question about how to invert UART signals without using UDB,
I created a simple project using TSoC (CY8C4146LQI-S433).
Probably same trick can be applied for other devices with SmartIO.
下記のスレでタイトルのテーマをいただきましたので、
トラ技付録の TSoC で作ってみました。
Schematic
SmartIO
LUT0, 1, 4, 7
Pins:
main.c
===================
#include "project.h"
#include "stdio.h"
#define RX_BUF_LEN 16
int main(void)
{
volatile char rx_buf[RX_BUF_LEN+1] ;
int i = 0 ;
CyGlobalIntEnable; /* Enable global interrupts. */
UART_Start() ;
SmartIO_Start() ;
for(;;)
{
UART_UartPutString("Hello\n\r") ;
CyDelay(100) ;
i = 0 ;
while(UART_SpiUartGetRxBufferSize()) {
rx_buf[i++] = UART_UartGetChar() ;
if (i >= RX_BUF_LEN) {
break ;
}
}
rx_buf = 0 ;
i = 0 ;
}
}
===================
Waveform
To test RX, I shorted P3[6] and P3[7] using a jumper wire.
And with debugger, I could confirm that rx_buf] received "Hello".
RX 側を試すのに外部で P3[6] と P3[7] をジャンパで繋いで実験してみました、
デバッガで確認したところ、rx_buf[] に "Hello" が入っていたので
送受信ともに反転で動いているようでした。
moto
- Labels:
-
PSoC 345 LP