Home / How To / Personal message showing gadgets: 16 steps

Personal message showing gadgets: 16 steps



Program

The program for the microcontroller is quite simple and consists of the following steps:

  • Set the needles for the first letter.
  • Delay a little
  • Set all pins to clear the screen (optional)
  • Delay a bit
  • Set the pins low for the second letter.
  • Rinse and repeat

I have attached the code I used. You can compile it with an XC8 compiler on MPLAB X. But since I used PA0 for segment A, you have to disable UPDI via the fuse bit for it to work (explanation below).

Choosing the right ports

Now you have to choose which ports on the microcontroller to use. Normally, there will be an 8-bit port and a 4-bit port for the 1

4-pin microcontroller. Since the 7-segment display has 8 cathode pins (including the decimal point), the 8-bit port is the most practical since you can use direct port access to set the port value in a single command.

Consideration 1: Cross Tracks

However, the choice may vary due to your microcontroller's output voltage and wire line between your MCU and the monitor. To make the job the easiest, you want the least amount of cross grooves.

For example, on ATTINY414, the 8-bit port is PORTA. If you assigned PA0 to segment A, PA1 to segment B and so on, the amount of cross-track 1 (segments F and G) is acceptable to me.

Protip: One side of the board can safely hold five resistors of 1/4 w. programming pins, these pins do not work as GPIO pins, therefore you may have to avoid them or disable programming completely, the choice is yours.

For example, on ATTINY414, the UPDI programming pin is on the A0 pin on PORTA. If you use this port as an output, it will not work as the port will be used as UPDI instead of GPIO. You have 3 options here with their advantages and disadvantages:

  • Disabling UPDI via fuse bits: You will not be able to program the unit again if you do not use 12v to activate the UPDI function (unfortunately I did but you do not & # 39; t must).
  • Use PA7-PA1 only: You will not be able to use a decimal point here unless you also use PORTB to help, but you will still have programming available (the best option).
  • Use PORTB to help: Longer code but also works if pinout is too cluttered otherwise.

Protip: Try to select the microcontroller with less amount of programming pins, ATTINY414 uses UPDI which uses only 1 pin to communicate, so you have more GPIO pins available.

Programming the unit

If you have a programming terminal for the SMD, you may want to program it before soldering the MCU to the circuit board. But if you don't, soldering can help you with programming first. The mileage may vary. In my case, I connect the PICKIT4 to a circuit board and then use my finger to push the MCU towards the card. It works but not very well (the programming terminal is now on my wish list).


Source link