Monday, June 4, 2018

A outline of what's in the test.

The test will be in our normal classroom on Tuesday 19 June at 8:00

There will be a picture of an Arduino like this below and you'll annotate it with text and arrows. You may be asked to identify a crystal, capacitor, resistor, LED or voltage regulator too.











There will be questions about a schematic involving the Arduino red board like the one below.


The red board schematic is on another page and in Spark Fun's site and in our blog.



Test Information

There will be a theory test on Tuesday 19 June. It will be closed book and you must complete it in 1 hour and 30 minutes.  All the items in the test we have discussed in class or will be notified in a revision class prior to the test. 

There will be a question on the main parts of the Arduino. See the labelled diagram above. This is not exactly the same as our Arduino but, apart from the DIL processor, USB to serial IC and colour, is pretty close.


There will be a question about the Arduino schematic diagram above or similar.

Also there's buggy program. A program will be given to you with errors in it. You will have to identify the errors. Mostly syntax violations.

A problem to do with sampling real world inputs will be given and you will be asked how you would respond to this using the Arduino.

You will be asked to write two simple assembly language programs.  One will involve a delay subroutine that you should prepare before the test.
 You will also be asked to write a program in Arduino C.

There may be other questions but only on items we have studied in class or in preparatory assignments, including serial buses, pin outs of the Arduino and the mega328p, voltage dividers, assembly language etc.

Please contact me about any problems. Good luck.

PeterB





Wednesday, May 16, 2018

This is a screen shot of an AVR assembler program that turns PORTB's least significant bit on and off very quickly.




;
; AssemblerApplication4.asm
;
; Created: 17/05/2018 10:15:30 AM
; Author : peterb
;

; Set up stack pointer and turn PB0 on and off. No delay.
start:
 out PORTB,r16
 LDI R16, LOW(RAMEND)
 OUT SPL, R16
 LDI R16, HIGH(RAMEND)
 OUT SPH, R16
 ;better make PB0 an output. Write a 1 into PB0 of DDRB.
 clr r16
 inc r16
 out DDRB,r16
repeat:
 clr r18
 inc r18
 rcall sendtob
 clr r18
 rcall sendtob
 rjmp repeat
 ; the subroutine is below. Always ends with ret.
 sendtob:
  out PORTB, r18
  ret

   

Wednesday, May 9, 2018

Set bit and clear bit

We can set and clear a bit in any internal register.


IO Ports

All AVR devices, like our Mega328, have ports. Usually they are a group of 8 pins that send or receive binary to or from the outside world.

There are three registers associated with each port.

  1. The output register PORTX
  2. The input register PINX
  3. The data direction register DDRX.
For instance port B is made up of 8 pins PB0, PB1, PB2 ....PB7. It has three associated registers:
  1. PORTB
  2. PINB
  3. DDRB
These registers live in the I/O register space just above the 32 general purpose registers.




Some good port pages:
Useful but about GCC.
Some good stuff here.

A outline of what's in the test. The test will be in our normal classroom on Tuesday 19 June at 8:00 There will be a picture of...