Presentation is loading. Please wait.

Presentation is loading. Please wait.

Decoding Barcodes Various approaches. Decoding barcodes There are a number of ways of decoding the barcodes –The data can be polled –The data can be read.

Similar presentations


Presentation on theme: "Decoding Barcodes Various approaches. Decoding barcodes There are a number of ways of decoding the barcodes –The data can be polled –The data can be read."— Presentation transcript:

1 Decoding Barcodes Various approaches

2 Decoding barcodes There are a number of ways of decoding the barcodes –The data can be polled –The data can be read on interrupt –The data can be sampled

3 Polling Repeatedly test the port B bit for state change, then –Store time value for the change Requires Port B set up and clock running Locks up the board, or risks data lose through multiple polling Data will require a lot of filtering

4 Port B Registers

5 Minos code to program port B

6 Program port B at low level

7

8 Timer Registers

9 Timer code

10

11

12 Interrupt driven code 2 possible sources for the interrupt –The bar code wand pin – Port B –The timer – Timer 2 The timer is only really needed if you require a time out to abort the read Requires some careful setting up of the various peripherals and care with the order of the code

13 Interrupt driven code Uses the resources of the board very well Once implemented properly it is a very elegant and simple solution Will allow other activities to take place on the board Can generate noisy data Can be difficult to debug

14 Interrupt Code

15

16

17

18

19

20 Coding using sampling This is an alternative interrupt driven method Rather than use the Port B interrupts it uses the timer to sample the Port B input Can use various settings for the timer The data read is just a count of 0s or 1s

21 Coding using sampling Allows flexibility in that sample rate is easy to change Only 1 source of interrupt – so is fairly simple Data read is very simple and easy to organise

22 Sampling Code

23

24


Download ppt "Decoding Barcodes Various approaches. Decoding barcodes There are a number of ways of decoding the barcodes –The data can be polled –The data can be read."

Similar presentations


Ads by Google