FPGAとシリアル通信 (2)

wave57

シリアルインターフェースを介して、8-bitカウンターの値を送出しています。黄色のトレースは、受信されたワードのLSBを示しています。

// Arduino
void setup() {
  Serial.begin(9600); //default 8-bit no parity, one stop bit
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
 }

int thisByte = 0x00;

void loop() {
  Serial.write(thisByte);
  delay(4);
  thisByte = thisByte + 1;
  if(thisByte == 256) thisByte = 0;
}
// FPGA
if(get_now == 1'b1) begin
    rx_shift <= {rx2, rx_shift[7:1]}; //LSB first
end

assign get_now = (async_count ==  9 || async_count == 17 || async_count == 25
               || async_count == 33 || async_count == 41 || async_count == 49
               || async_count == 57 || async_count == 65 )? 1'b1 : 1'b0;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.