[Oberon] PO2013 - Real time measurement

Paul Reed paulreed at paddedcell.com
Mon Mar 25 00:37:05 CET 2019


Hi Tomas,

> [2] PIC16F818...has a lot more features, e.g A/D, also SPI / I2C.

As I mentioned before, I've been using the PIC16(L)F1455/9 because they 
have even more features still, for about the same price.  But the 
PIC16F818 seems perfectly good, since it seems to be able to run at 3.3V 
as well as 5V.  For interfacing with the FPGA, you should power it at 
3.3V.

I notice the PIC16F818 also supports low-voltage programming (LVP), so 
you should be able to program it using a modified version of Prof. 
Wirth's PICL directly from the FPGA, without having to buy a special PIC 
programmer.  I've recently programmed the PIC16LF1459 successfully using 
LVP from Oberon running on an FPGA; the changes were not onerous.


> Manual gives these signals on SPI
> 
> Serial Data Out (SDO)        RB2/SDO/CCP1
> Serial Data In (SDI)         RB1/SDI/SDA
> Serial Clock (SCK)           RB4/SCK/SCL
> Slave Select (SS)            RB5/SS
> ... the signals above are named differently to Oberon RISC5 docs??

The PIC documentation names the SPI signals slightly differently because 
it can be configured as an SPI master or a slave.  If it's a slave 
(which is what you want), then SDI (SPI data in) is connected to the 
FPGA's MOSI (master out, slave in) and SDO (SPI data out) is connected 
to the FPGA's MISO (master in, slave out).


> I like this picture on SPI chip select addressing.
> 
> Oberon GPIO is 8 bit, some can be configured to ... SPI signals, I
> hope.

Yes.  I designed the SPI interface to be very simple and low-level, in 
contrast to a lot of system-on-chip designs.  You can connect any of the 
Oberon's GPIO to the PIC16F818's SS pin, and use the existing Oberon SPI 
master interface to operate the SCK, MOSI and MISO lines, without 
interfering with the SD-Card and network, because their SS pins will 
stay inactive if you leave the relevant SPI control port bits (port 
0FFFD4H, -44, bits 0 and 1) at 0.

There's a slight caveat there, in that if you use interrupts, you will 
have to take care not to interfere with other uses of SPI.  There are of 
course many ways of dealing with this but most will involve changing the 
hardware.  Fortunately, it's an FPGA. ;-)

But of course the whole point of using a PIC, apart from adding the 
analogue interface(s) that simply don't exist on the FPGA, is to offload 
some of the processing (which is exactly what the PIC was designed for 
in the first place) so polling may well be fine as a solution.


> This is now long term goal of mine>
> I want to achieve an interconnection of field instruments with
> Oberon system through PIC, incl. A/D, D/D, etc conversions. So one 
> could
> measure temperature, and other physical qualities. And at the same time
> drive some actions on the controlled process, valves open/close, servos
> on/off. Ideally with proportional regulation.
> 
> I wish to start with a simple thermistor temperature probe, A/D
> conversion, and some trending in Oberon system.

The PIC16LF1459 has a temperature sensor built-in, but if you want to do 
probing where the environment is unfriendly to a chip then a thermistor 
probe does indeed make sense. :)

You could store the trend data (up to ~128 bytes, less what you need for 
the program scratch registers) in the PIC's data memory (or in EEPROM) 
and then you wouldn't even need a background task in Oberon.

HTH
Paul


More information about the Oberon mailing list