With the advent of the USB protocol in the 90's many peripherals' manufacturers abandoned the previous protocols and connections to adopt it as a unifying standard; in the past printers mostly used parallel/Centronics ports, modems were serials, scanners could use SCSI interfaces, which often required a daughter board to be placed inside the cabinet of PC's, and mice and keyboards had to be connected to PS/2 ports.
In this experiment we will use PIC 18F4550 little bro, the 18F2550; it has (mostly) the same features as its oldest sibling but with a reduced number of IO's, making it suitable when there is no need of many ports.
In this article we are going to experiment with an ultrasonic sensor, the HC-SR04; it seems quite known and common, especially in the Arduino community, maybe because it is quite cheap and simple to operate.
Wanna discover how we can use it to measure the distance of an object, by interfacing it to the Freedom II development board? Yes? Coool! So... let's get started!
7-segment displays are an effective and still widely used way of displaying alphanumeric data.
In fact they are quite simple, because they consist of 8 leds (decimal point included) connected in parallel and with the cathode (or anode) in common; by turning on specific leds ('segments') a number or letter is displayed.
In this project we are going to implement two different buses to get data from and to a PIC18: serial RS-232 and I2C bus. For an intro to I2C please see Wikipedia; the scenario that was implemented below is the one in which the PIC operates in master mode.
Skimming through the PIC 18F4550 istruction set we can see, among others, a bunch of branch instructions.
What are they for and what's their relationship with the STATUS register? Let's see them in practice using some assembly code examples. This will also be a nice occasion to do a bit of simple HEX math.