モニターの回路はできましたが、ソフトの変更の度に車に乗り、PCと書き込み機を車内で動かしてというのも面倒だったので、一定のアンサーバックしかしない回路も作りました。
回路は先日アップした回路図から液晶を外しただけのものですが、Port B5にLEDをつなぎ、この回路からのデータ送信中に点灯するようにしています。
BASCOM-AVRの試用版でコンパイルできます。
----------------------------------
' $sim
Rem Chip config
$regfile = "m328def.dat"
$prog &HFF , &HFF , &HD6 , &HFD ' generated. Take care that the chip supports all fuse bytes.
$crystal = 16000000 '16Mhz
$hwstack = 64 'ハードウェア・スタックの容量を設定。
$swstack = 64 'ソフトウェア・スタックの容量を設定
$framesize = 32 'フレーム領域の容量を設定。
Config Com1 = 9600 , Synchrone = 0 , Parity = Even , Stopbits = 1 , Databits = 7 , Clockpol = 0
Echo Off 'Input echo off
' Echo On 'for simuration
Config Portb.5 = Output
Config Aci = Off
Dim Recive As String * 5
Dim Dat(14) As String * 56
Dim Hos(14) As String * 56
Dim Count As Byte
Raw_dat:
rem 0000000001111111111222222222223333333334444444444555555
rem 1234567890123456789012345678901234567890123456789012345
Dat(1) = "0141304680019700208078000021440301006816010240000035220"
Dat(2) = "0138804730020100208078000011450310007116010240000034196"
Dat(3) = "0142704700020200208078000021440303006916010240000033428"
Dat(4) = "0140104730020500205078000011440311006916010240000032660"
Dat(5) = "0129104760027500198078000021420305006916010240000030868"
Dat(6) = "0126504770028200195078100021440304007216010240000031124"
Dat(7) = "0130604730028700197078000021450299007016010240000030868"
Dat(8) = "0120804550037100194078000021440268007016010240000032660"
Dat(9) = "0124504490038400194078000011450264007016010240000032916"
Dat(10) = "0121204490039700194078000011430261007216010240000032916"
Dat(11) = "0104404440083065535076600101400221007620010240025632896"
Dat(12) = "0104404440100001000076600101400221007620010240025632896"
Dat(13) = "0000000006553565535000000000000000000000000000000000000"
Dat(14) = "0000000000000000000000000000000000000000000000000000000"
Raw_hos:
rem 0000000001111111111222222222223333333334444444444555555
rem 1234567890123456789012345678901234567890123456789012345
Hos(1) = "0099901227010920100001000010000100101000010000000000000"
Hos(2) = "0100101154010690100001000010000099901000010000000000000"
Hos(3) = "0100001212010880100001000010000100001000010000000000000"
Hos(4) = "0100001204010860100001000010000100001000010000000000000"
Hos(5) = "0100001195010850100001000010000100001000010000000000000"
Hos(6) = "0100101185010810100001000010000099601000010000000000000"
Hos(7) = "0100101149010660100001000010000099801000010000000000000"
Hos(8) = "0100101146010640100001000010000099901000010000000000000"
Hos(9) = "0100101141010620100001000010000099601000010000000000000"
rem 1234512345123451234512345123451234512345123451234512345
Hos(10)= "1000001100012000130001400015000160001700018000190002000"
hos(11) = "0000000000000000000000000000000000000000000000000000000"
hos(12) = "0000000000000000000000000000000000000000000000000000000"
hos(13) = "0000000000000000000000000000000000000000000000000000000"
hos(14) = "0000000000000000000000000000000000000000000000000000000"
Count = 1
Jusin1:
Reset Portb.5
Input Recive
If Count = 15 Then Count = 1
If Recive = "?DAT" Then Goto Send_dat
If Recive = "?HOS" Then Goto Send_hos Else Goto Jusin1
Send_dat:
Set Portb.5
Print Dat(count);
Goto Cc
Send_hos:
Set Portb.5
Print Hos(count) ;
Goto Cc
Cc:
Count = Count + 1
Goto Jusin1
-------------------------------------------------