Examples Astrobe RISC5

General discussions about using the Astrobe IDE to program the FPGA RISC5 cpu used in Project Oberon 2013
Post Reply
julian_96
Posts: 1
Joined: Wed Feb 21, 2018 12:09 am

Examples Astrobe RISC5

Post by julian_96 » Fri Jun 01, 2018 3:04 am

Hi! I've got an Arty 7 board, and I implemented Oberon succesfully. I am getting started on the topic and I want to understand how to use some peripherals like GPIO, Buttons, Switchs and A/D. So, I am looking for more examples apart from blink.mod. Thanks

cfbsoftware
Site Admin
Posts: 405
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Examples Astrobe RISC5

Post by cfbsoftware » Fri Jun 01, 2018 1:49 pm

The states of both the buttons and the switches are stored at address 0FFFFFFC4H (decimal -60) as documented in Chapter 17 The processor's environment of the Project Oberon book. You can access this from the Astrobe > Help > Project Oberon menu.

The switches are represented by bits 7..0 and the buttons by bits 15..8.

e.g. if switches 0 and 2 are on then bits 0 and 2 are set. If button 0 is pressed then bit 8 is set etc. You can use the built-in Oberon functions SYSTEM.GET and SYSTEM.BIT to access words, bytes and individual bits at specific addresses. Example source code for both is included in the latest release of Astrobe for RISC5. However, I recommend that you try to write a simple example yourself first and only look at the examples if you get really stuck.

Once you have understood how switches and buttons can be programmed you should be ready to tackle GPIO. Here are some hints to get you started:

Code: Select all

GPIOAddr = -32; 
GPIOControlAddr = -28;

SYSTEM.PUT(GPIOControlAddr, {bitNo});  (* Set bitNo to be an output *)

SYSTEM.PUT(GPIOAddr, {bitNo}); (* Set bitNo *)
As for ADC I believe you'll have to write some Verilog code to access the ADC features on the Arty board. Have a look at the Arty XADC demo on Digilent's website. However, if your Verilog skills are limited you might be better off investigating Digilent's Pmod AD5: 4-channel 4.8 kHz 24-bit A/D Converter as it has an SPI interface. The SPI code example we wrote for the SparkFun Real-time Clock breakout board should be a useful starting point to get it working.

cfbsoftware
Site Admin
Posts: 405
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Examples Astrobe RISC5

Post by cfbsoftware » Fri Aug 09, 2019 11:45 pm

v7.0 Astrobe for RISC5 includes additional source code examples, including using the button, switch and GPIO peripherals.

Post Reply