It's a so-called mask. The thing is, you get the RGB value all in one integer, with one byte for each component. By performing a bitwise-and with 0xFF, you keep just the last part, which is blue. For other channels, you'd use:. If the color mask is not performed, consider RGB 0,0and the threshold The getRGB Which is clearly more than the threshold But the intent was to ignore the other two color channels. The bitmask gets only the lowest 8 bits, with is zero.
So it is a conversion to black and white based on a simple pixel-by-pixel threshold on a single color channel.
Its binary representation is:. It returns an integer with all its bits equal to 0 except the ones which are equal to 1 in both i1 and i2. It is probably because there is some conversion to or from ARGB. This is a really good blog post about why to do bit-wise operations for colors. Learn more. Ask Question. Asked 9 years, 1 month ago. Active 2 years, 9 months ago. Viewed 57k times. Lunar Lunar 4, 7 7 gold badges 38 38 silver badges 50 50 bronze badges.
Thread starter cmartinez Start date Jul 6, Search Forums New Posts. Thread Starter cmartinez Joined Jan 17, 6, I'm completely unfamiliar with any of Microchip's products, but now it has become imperative that I work on a small project involving the PIC10LF As a reference, I consider myself quite proficient with the architecture, but the PIC architecture is alien to me. So I'd very much appreciate it if any of you had the patience of helping me walk through my first baby steps.
I've already bought a few of said chips, and bought a PICkit 3 programmer for this application. My most important requirement is that I learn how to program this chip using assembly language, and not C. Specifically, I'd like to be pointed to: - Where can I download an assembly compiler for this chip?
I need to learn and study its syntax and general rules, so some sort of manual or even book that I could buy or download would be appreciated. Of course, I've already studied the datasheet, and have begun to understand some of the concepts involving its different registers and interrupts.
But I have no clue as to how and where to start programming and compiling assembly, and then loading the program into the chip. Scroll to continue with content.
Raymond Genovese Joined Mar 5, 1, Raymond Genovese said:. Thanks Ray! Right now I'm studing the examples included in the software. Thanks for linking me to the PIC tutorials, I'll have a look at them and let you know how it went.
Last edited: Jul 7, AlbertHall Joined Jun 4, 9, I both love it and hate it. But, as usual, you use it and get used to it and it works, pretty much, anyways. Then, you switch to something else and have to get used to it and switch back and so on and so forth. I felt the same way about Eclipse, and then got used to it.
I can even get used to Visual Studio stuff. Still, there is pain in spending more time in figuring out how to use the program instead of using the program to write programs. For all of its limitations, Arduino IDE took all of about 10 minutes to learn or so it seems. Dodgydave Joined Jun 22, 9, MaxHeadRoom Joined Jul 18, 20,Join us now! Forgot Your Password? Forgot your Username? Haven't received registration validation E-mail? User Control Panel Log out. Forums Posts Latest Posts.
View More. Recent Blog Posts. Unread PMs. Forum Themes Elegant Mobile. Essentials Only Full Version. Super Member. Why the movlw 0xff? What is the purpose of this literal move?
Re:Why the movlw 0xff? Hello Bruce, Can you post a snippet so we can see this in context? Thanks, Ken. But it is in almost every ASM file in the C18 source. Also in the sample code in the c19 User Guide for calling assembler from C.
Read about how the software stack is implemented in the C18 manual. Its basically blank memory. If you blank your chip then it will display this opcode throught the program - give it a whirl. Therefore its not putting it where you think it is, or not at all! Brick Its basically blank memory. And the OP isn't talking about blank memory, he's talking about assembly source code with MOVLW 0xFF instructions which are there intentionally, for the purpose of accessing the C stack. Its been a while!
Thanks jtemples. Sorry I did not notice that someone responded to this thread. It has nothing to do with the PIC's stack, it's the compiler's software stack.
That is documented in the C18 manual as I mentioned above. I believe it's in the "Calling Conventions" section. Latest Posts. Active Posts. All FAQs. What's the alternative?Search everywhere only in this topic. Advanced Search. Classic List Threaded. High Nibble. The "0" 4 bits or the "1" 4 bits? Re: High Nibble. Harold Hallikainen In reply to this post by V G.
Steve Smith. RE: High Nibble. Now Sun winder But with larger numbers you need first to be aware if the number you are dealing with is Big Endean or Little Endean That is the order of the bytes in a word or where the high order bits are. All the above are Big Endean with the most significant bit on the Left hand side And of course all the above 1's could also be 0's By the way unless you are using a very odd processor with seven bits W should contain b'' or.
In reply to this post by Harold Hallikainen Matthew Miller Hi Solarwind, When writing out binary digits the least significant bit LSB is usually on the far right. Likewise, the most significant bit MSB is on the far left. For this case, the high nibble of a byte would be the four left-most bits. You might also want to read about endianess. Thanks, all of you, very useful information. David Meiklejohn. In reply to this post by Rolf To me, it's more consistent with byte.
Not that it particularly matters! David Meiklejohn www. Olin Lathrop.Forums New posts Search forums. Articles Top Articles Search resources. Members Current visitors. Log in Register. Search titles only. Search Advanced search…. New posts. Search forums. Log in.
PIC12C508A : WDT Reset during sleep problem
ZenZ94 New Member. Is there any existing command to call the 2nd line LCD bar? See 4-bit operation on pages 39 and 42 of HD SETB P1. You need to tell the display to go to the start address of the second line. This is an example from some code I wrote several years ago.
I think bit 7 of the command means to move the address in the lower bits to the display position pointer. Again you will find the command format in the data sheet. Les Jones said:. The program given by Les is for the PIC mcu. You cannot just simply copy and past it into your simulator.
PIC Code for Binary to Decimal Conversion
You have to understand the idea behind it and convert the idea to code in order to work. Most Helpful Member. There is code here in assembly!!! Last edited: Dec 27, Last edited: Dec 30, Forums New posts Search forums. Articles Top Articles Search resources. Members Current visitors.
Log in Register. Search titles only. Search Advanced search…. New posts. Search forums. Log in. Welcome to our site! Electro Tech is an online community with overmembers who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register.
Hi kk welcome, got it wrong first post had to clearThis is for PIC16 but will get you started. Edit Code:. Last edited: Mar 28, There are examples for 16F series in my tutorials, it makes it nice and easy and fast if you use a lookup table.
Timer0 interrupt 16FA [Assembly]. Thread starter azhari24 Start date Dec 5, Search Forums New Posts. Thread Starter azhari24 Joined Dec 5, 7. I use TMR0 interrupt for send data. I setting TMR0 active every 8ms, prescaler This is my program. Rich BB code :.
Scroll to continue with content. Markd77 Joined Sep 7, 2, I can't see anything obvious, can we see the variable declarations and the subroutines please? I don't have time to dig through all your code, but here is a suggestion: Don't preform the actual data transmission during the interrupt. Even better, I would do this: 1. Set a flag when 3 conversions have been captured 1 for each channel.
When it is set, transmit the data. Markd77 said:. I don't have time to dig through all your code, but here is a suggestion They need to be kept in the area which is available in all banks.
Hopefully these will get it closer to working.