In our last chapter, we discussed adding a BMP180 to a PiDP11, and adding a device driver to RSX to read it (and when I say RSX, I'm talking RSX11 M-Plus).
If you followed all that and got the thing assembled and built, loaded and connected, you were rewarded with an online, ready device...
>DEV BM0:
BM0: Loaded
>
But, that's not all that useful, or interesting. One presumes that if there is a device there, it would be good to see some data out of it.
So it's time for a demo program. All you have to do is assign a channel to the device, and then do an IO.RLB QIOW to it. What could be easier?
I wrote getone.mac to do just that. It also converts the data to ASCII, in units we are familiar with - the BMP180 returns data as Celsius*100 , and Bars*10000 - I converted to degrees F and Bars, then write 'em out for your viewing pleasure.
So, here's the code....reading the values from the device is about 4 or 5 lines of code - the rest was arithmetic and formatting.
getone.mac
To use it, assemble and link it...
mac getone=getone
tkb getone=getone
Then run it...
>run getone
Temperature 76.20 degrees F. Pressure 1.0116 bar.
Whew...starting to get a little warm in here...time to open the door and let a little winter air in. Next entry, I'll show a couple of high level language examples, for people who aren't familiar with Macro-11.
No comments:
Post a Comment
Comments?