Using an AND mask to ensure a binary number stays within designated bounds. I want to use an 8-bit microcontroller register to produce numbers between 0 and F hexadecimal (not 0 and FF).
Good morning all…
Youtuber, shed dweller, solar charge controller aficionado
This site uses Akismet to reduce spam. Learn how your comment data is processed.
I've been trying to find videos to learn more about this subject and you seem the only person to explain it so level headed, and easy. Thank you so much for the tutorial and lesson.
I haven't seen assembler since my BBC Micro days.
Julian, OK, you've got me. Please explain the linear feedback shift register. Are you going to add these PIC videos as a sort of primer to your eventual PIC programming series?
Very clear, wonderful to watch
Ooh more PIC videos! Keep 'em coming 🙂
Really enjoyable video, Julian. I've ordered that same dev board from eBay and a pixel ring. I've done a lot of assemble coding on the C64 and Dos PC days. This is a good teaching format, as the device has such good visual feedback.
Keep 'em Coming!
Post-it overflows!
Happens to me too, all the time.
I'm not famliar with PIC but couldn't you and against an immediate value rather that shifting an immediate value into a register and anding against said register?
Wow… now that was an impressive, and instructional video Julian. No wonder we didn't hear from you for a week. Thank you VERY much!
Great video! I love learning about this lower level programming.
Using a real life example made it easier for me to understand
Julian – perhaps its not completely your sort of thing I was wondering if you would do a video about triacs controlling high power (200 watts) load. Seems there are not many quality videos about the subject.
I enjoyd this video. Well presented. Regarding the lfsr, if you want next outcome to be less dependent on the previous (hence the random pattern on the ring seems to run a little bit down on each side), you can add a second lfsr and xor them together. Note1: The registers must be of different sizes, for example, a 16bit lfsr running and its lowest 8 bits are xored with your 8 bit lfsr. The statisticall independency between the outcomes are improved. Note: Only a subset of all tap-masks give the longest running sequence for any lfsr. By tapmask i mean the number you xor in at the beginning after rotating. In my video I started out with a fibonacci/external type lfsr (also called simple lfsr) because I didn't understand lfsr yet, so you went on with the computational efficient type (Galois/internal). The theory indicates that the lfsr is rotated right, but in pic assembly I found it easier to rotate left because then you can use carry as the feedback 🙂 (I also had to invert the tap-mask ofcourse.)
Yes, do a video on pseudo random.
I want to point out another neat trick in assembly language (which I don't use anymore). The destination flag of some instructions can be very helpful. Let's say you use led_position in an interrupt and you don't want the interrupt to see a number >15. You could do all the work in WREG and first instruction does both decrement and copy f -> W:
decf led_position, w
andlw 0x0F
movwf led_position
Of course you shouldn't change led_position in the interrupt in this case.
Sry for my grammer…but i would say a simple clue is enough for the clever… LOL.. 😅😅