プログラムについては、先にPIC側を決めて固定しておきたい。
親機から、3文字単位で、コマンド1文字、データ2文字を送り、I/O端子毎の処理をさせる。
1文字コマンドは、取り敢えず次のようなものにした。 l(A0〜A7 data to PORTB), m(A8〜A15 data to PORTD), h(A16〜A17 data to PORTE) d(D0〜D7 data to PORTA), r(read data from PORTA), w(Write data to PORTA) e(Erase a block), p(Program to PORTA at Vpp on)
で、例えば、先に、lxx、myy、hzzとアドレスを設定させてから、読み書きする。
...詳細は、実験しながら決めて行く。
先日まで、PICマイコン(PIC16F887)のプログラム書き込みに、「AE-PICPGMII」を使っていたのだが、偶々、ICE「PICKit3」(の相似品)を見付けたので、(リスクを承知で)これを買ってみた。(¥1,878送料込み)
「MPLABX IDE V5.25」と組み合わせると、ダイレクトでプログラムを書き換えられて、大変便利が良い!(図3)
(当初は、相当梃子摺るだろうと思っていたが、意外に、すんなり使えるようになった)
プログラム作成の方は、相変わらずモタモタだが、やっとフラッシュ・メモリ「28F002BX-T」の内容が読み出せそうな雰囲気になって来た。(図4[クリック])
先頭のコード"55AA00EB..."が、何やら、それらしいではないか!?
(コンソール側は、今は、「Tera Term VT」を利用させて貰っている。感謝!)
尚、「PICKit3」は、系全体をコンパクトに出来るし、デバッグのサイクルを速く出来るのが、良い点だ。(図8[クリック])
しかし、"操作"は全部、親プログラム「MPLAB X IDE」の方に任せっきりにするので、楽ちんではあるが、自分が少し、"呆け"になった気分だ。
ICD(インサーキット・デバッガ)について、もう少し知識が増やせるかなと思っていたが、逆だった。
Mr. Moonlight has already read, analyzed, and modified the BIOS contents of " PC110 ". When I heard it, I said, "I can't lose!", Whipping on my old bones (?), And trying again to make my homemade " Flash Writer " for "reading and writing the BIOS chip".
That said, due to lack of knowledge and skill, it is not possible to proceed immediately. Step by step like "mountain climbing".
Last stopped is still overestimating the function of " PIC16F887 ", and reading and writing the flash chip is easy.
" PIC16F887 " has enough I/O terminals to cover DATA = 8, ADDRES = 18, communication/control = 8 + α, but on the other hand, the amount of data memory that can be used by the program was too few.
I was thinking about processing a large amount of data, but that was impossible.
Last time, I was thinking about writing a lot, but I didn't try "reading".
So, this time, I decided to start step by step from " read " and didn't care much about "read/write speed".
(However, it cannot be shortened as expected because it is written in a C-like language.)
Let PIC do "simple processing" as much as possible, and the rest is on the master PC.
Regarding program , I want to decide and fix the PIC side first.
The master PC sends one command character and two data characters in units of three characters, and processes each I/O terminal.
For the time being, the one-character command is as follows. l (A0-A7 data to PORTB), m (A8-A15 data to PORTD), h (A16-A17 data to PORTE) d (D0 to D7 data to PORTA), r (read data from PORTA), w (Write data to PORTA) e (Erase a block), p (Program to PORTA at Vpp on)
So, for example, first set the addresses as lxx, myy, and hzz, and then read and write.
... Details will be decided through experiments.
For hardware , two boards are connected by a "horizontal rail" and housed in the housing (of the original modem), which is open when in use and completely covered when not in use. I made it possible.
The circuit configuration has been slightly improved and modified from the previous one, and ICE ( PICKit3 ) can also be connected. (Fig.2 [click])
The temporarily attached LED display line will remain connected in the future so that the ON/OFF status of the data D0 to D7 and the address A0 to A17 can be seen at all times.
This is a copy of the "flickering lamp" found on old computer panels. (Fig.1)
It's not possible with the current multitasking method, but in the case of the previous single task program, where in the memory it is loaded and running, deadlock is settled around here, etc. It was said that it was used for debugging after making a judgment.
Now I can see the data being retrieved from the "BIOS chip". z(^^;
+++ Integrated environment system +++
Until the other day, I used " AE-PICPGMII " to write the program of the PIC microcomputer ( PIC16F887 ), but by chance, I found a ICE " PICKit3 " (similar product), so I bought it (with aware of the risks). (\ 1,878 including shipping)
When combined with " MPLAB X IDE V5.25 ", the program can be rewritten directly, which is very convenient ! (Fig.3)
(At first, I thought it would be a lot of leverage, but surprisingly, I can use it smoothly.)
My program creation is still fluttering, but at last it seems that the contents of the flash memory " 28F002BX-T " can be read. (Fig.4 [click])
The first code " 55AA00EB ... " seems to be like that! ??
(The console side is now using " Tera Term VT ". Thank you !)
Actually, it's my delusion/dream range, but without removing the "BIOS chip" of " PC110 ", it can be rewritten to a turtled another chip. I'm thinking about a plan.
(Currently, " RP#terminal "of " 28F002BX-T " is set to VH and VHH, but eventually, I would like to check the function of it when it is low)
This Flash memory " 28F002BX-T " is quite intelligent, and it can be display (instruction) "command" and (status) "status".
However, if the program creator does not deal with them properly, it will not work properly.
(For me who wants to save as much effort as possible, it's only annoying, but I have to do it even if I don't like it)
Anyway, it takes time to write and erase, so I think that such trouble is unavoidable.
... After reading (of the BIOS chip removed from " PC110 ") according to the specified procedure, the "contents" can be read (although partly) properly. It was.
Therefore, I decided to replace the chip with a "new one" and start a write/erase experiment.
But, for some reason, writing and erasing could or could not be done !??
Apparently, the Vpp (= + 12V) supply system is not good.
I changed the circuit constants and circuit configuration of the supply circuit using two transistors, but the supply voltage could not be maintained at + 11.4V ?!
So I decided to use a "mechanical relay" as described below.
Since then, stable "erasing" has become possible. (Fig.5)
In addition to that, due to the detailed work and debugging of the program, it is now possible to write, read, and erase blocks within a certain range while manually inputting.
Still inadequate is the issue of timely reading of status flags and cleaning them.
Even though the erasure has been completed, a warning such as "Cannot Erase !" Appears.
The "+12V switching circuit" has been moved to the small board side (where hardware debugging is easy). (Fig.6 [click])
+++ Hardware +++
In the instruction manual of " 28F002BX-T ", there is a description that "+ 12V supply can be switched operation", but I am not sure, so I dare to switch automatically. I used a relay ( Omron 12VDC, 8~10mA). (Fig.7)
With this, the voltage drop can be reduced to almost zero.
The good point of " PICKit3 " is that the entire system can be made compact and the debugging cycle can be speeded up. (Fig.8 [click])
However, all the "operations" are left to the parent program " MPLAB X IDE ", so it's easy and fun, but I feel like I become stupid a little.
I was wondering if I could gain a little more knowledge about ICD (In-Circuit Debugger), but the opposite was true.
In anyways, after investigating the state as it is, I am now entrusting the console to " TeraTerm VT (19200bpm)", but this is a "self-made program" I'm thinking of replacing it.
Now, this home-made device (Fig.1) is about to reach a crossroads.
I'll change my goal a little, so I'll change the name to "Reader".
A program ( FlashReader.exe ) created using " VB6 ( Visual Basic 6.0 ) can "read" from the Flash memory "28F002BX-T", and "write" and "block erase" to it can be done by manual . It has become. (Fig.2 [click])
However, batch writing to a file and continuous writing to Flash memory with data read from a file have not been finished yet.
The original goals also included "writing to a file", "reading a file" and "writing to Flash memory" by automatic .
However, the pace of my own work is too slow, so I will focus on "Making a file" of Flash data.
(For "writing to Flash memory", I think that ready-made products can be used it if possible.)
In other words, this one should be " Flash Reader " (nominary read only).
The reason it's stagnant right now is that writing "binary files" doesn't go as expected.
After investigating various things, it seems that it has something to do with "unicoding characters" of " VB6 ".
I still don't know how to solve the problem.
"Binary file conversion" is easy to stop, but if I stop it, I'll not be able to remember the details the next time I return, so I would like to continue if possible.
Alright, let's do my best !
By the way, regarding the problem of "processing speed", the reading of " VB6 " on the program side is too fast, and the one-chip " PIC16F887 " The response on the side is often not in time.
If I do not put "wait" in various parts of the program, data on the Flash side may be missed or data errors may occur.
Note that when I execute the "exe file", it will be faster than when I call it from the console of " VB6 ", so I have to increase the "wait" time !
However, it may be natural because the execution machine of " VB6 " has a clock of 2.1GHz and one-chip has a clock of 40MHz.
+++ VB6 program +++
The "text file" can be exported as intended, but somehow the "binary" has irregular data and for some reason it doesn't work. (Fig.4 [click])
When I write out the contents of the "string variable" with "Binary", the decimal numbers are OK, but the alphabetic characters (on hexdecimal numbers) are output only with "0". (Fig.3)
As usual, if the contents of the "Byte variable" are used, they will be output as 0 ... 9, A, .. F, etc.
I tried various methods such as Val, Hex, Right $, etc., but I can't transfer the "string variable" to the "byte variable" correctly.
... Here, it is stagnant.
However, even a "text file" can be used for disassembly if it is post-processed, and it should be useful.
Then, I may be able to "compare and examine the contents of the BIOS".
However, if possible, "binary files" will be easier to post-process and will be easier to use. (If one fail here, the Han (man) not be !?)
... But there are many other things I want to do ! ... I don't want time to stop, but can't I run faster ! s(^^;
I divided various parameters into two frames and made a menu attached to the side of the main screen (RichTextbox). (Fig.5)
The " RS232C setting " must be changed on the one-chip " PIC16F887 " side at the same time, so in fact, it does not need to be an explicit menu. So I'm going to hide it someday. (Fig.6 [click])
Currently, the baud rate is set to 9600bps, but it may change again depending on the situation.
In " Flash setting ", "start address" and "number of read blocks" are specified, but this is one of the problems, and "1 byte hexadecimal number" cannot be left as it is. Can not.
Numbers from " 00 to 99 " can be used as they are, but when " A to F " for hexadecimal numbers are entered, they are treated as simple characters. Therefore, only the number part is converted to "number".
Moreover, it seems that the character group is handled by unicode and becomes a different code.
Because of that process, I have had a lot of trouble.
When I think so, it seems that "&H" + Text1(0), which is the variable Text1(0) preceded by "&H +", is also treated as a hexadecimal number, so ("&H" is added. For me, who thought that only real numbers such as "&H1234" would be possible), I was surprised and my eyes would become to a point.
+++ Binary output requires strange processing +++
I'm struggling to output a "binary file".
When I output it straight and look at the "binary file", it's very strange ! (Fig.8 [click])
However, this seems to be manageable with correction !
Up to a certain range, when I subtract &H1E , a normal value will be output, but a value above " &H28 " is still sufficient. It doesn't seem to be.
In the end, I tried various experiments (without knowing the theory) and got a normal binary output. (Fig.7)
By the way, it is said that the data will continue after the "data length information (1 byte)" to be sent is added to the beginning of such "binary output".
Initially unaware of it, I was desperately trying to get rid of it, suspecting it was a bug in my program.
... It was a waste of effort.
At present, a serious "binary file" has been created.
+++ Depending on how DoEvents are placed +++
Last time ... " VB6 " is read too fast on the program side, and the response on the one-chip " PIC16F887 " side is not in time. There are many. I wrote that, but it was actually the opposite.
Rather, even for " VB6 ", "displaying on the screen" and "writing to a file" may take some time.
My old knowledge was that programs would be executed in the order they were written.
However, in an object-oriented programing/multitasking programing, it seems that the work/work that can be done quickly (that is, the object) has been completed first, and then waiting to be called .
If one inadvertently call it first, the output order may be reversed. (Fig.7)
For example, the last " &HFF " that should have been output first is after the next block address " 0100 " output. There is.
The only way to get this in the correct order was to simply change the stroke order of the program, and in the end, the only way to do this was to choose where to put the " DoEvent s" command. (Fig.8 [click])
The upper "DoEvents" is the outermost side of the double loop and the lower "DoEvents" is the innermost side of the loop.
However, when it is outside the double loop, the display does not appear in the middle after starting, and when it appears, it is a moment.
when I put it on the innermost side, the display will appear one by one.
However, this is also a cause of incorrect output , so it is a procedure that I would like to avoid if possible, but it is also attractive.
(It may be similar to the difference between going by regular train or by plane to enjoy the trip)