Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include <htc.h>
#pragma config FSCM = OFF, IESO = OFF, OSC = INTIO2
int mask = 0b11110000;
int fourbits;
void main()
{
ADCON1 = 0x70;
TRISB = 0b00000000;
PORTB = 0b01010101;
fourbits = 0b1000;
PORTB = PORTB & mask;
PORTB = PORTB | fourbits;
}
13: fourbits = 0b1000;
FE8 0E00 MOVLW 0
FEA 6E02 MOVWF 0x2, ACCESS
FEC 0E08 MOVLW 0x8
FEE 6E01 MOVWF 0x1, ACCESS
14:
#include <avr/io.h> // Include register definitions
int mask = 0b11110000;
int fourbits;
int main(void)
{
// Infinite loop
while(1)
{
DDRB = 0b00000000;
PORTB = 0b01010101;
fourbits = 0b1000;
PORTB = PORTB & mask;
PORTB = PORTB | fourbits;
}
}
#include <avr/io.h> // Include register definitions
int main(void)
{
// Infinite loop
while(1)
{
int mask = 0b11110000;
int fourbits;
DDRB = 0b00000000;
PORTB = 0b01010101;
fourbits = 0b1000;
PORTB = PORTB & mask;
PORTB = PORTB | fourbits;
}
}
00000068 LDS R21,0x0100 Load direct from data space
PORTB = 0b01010101;
0000006A LDI R20,0x55 Load immediate
fourbits = 0b1000;
0000006B LDI R24,0x08 Load immediate
0000006C LDI R25,0x00 Load immediate
DDRB = 0b00000000;
0000006D OUT 0x17,R1 Out to I/O location
PORTB = 0b01010101;
0000006E OUT 0x18,R20 Out to I/O location
fourbits = 0b1000;
0000006F STS 0x0103,R25 Store direct to data space
00000071 STS 0x0102,R24 Store direct to data space
PORTB = PORTB & mask;
00000073 IN R18,0x18 In from I/O location
00000074 AND R18,R21 Logical AND
00000075 OUT 0x18,R18 Out to I/O location
PORTB = PORTB | fourbits;
00000076 IN R18,0x18 In from I/O location
00000077 LDS R19,0x0102 Load direct from data space
00000079 OR R18,R19 Logical OR
0000007A OUT 0x18,R18 Out to I/O location
0000007B RJMP PC-0x000E Relative jump
int mask = 0b11110000;
int fourbits;
DDRB = 0b00000000;
PORTB = 0b01010101;
00000068 LDI R25,0x55 Load immediate
DDRB = 0b00000000;
00000069 OUT 0x17,R1 Out to I/O location
PORTB = 0b01010101;
0000006A OUT 0x18,R25 Out to I/O location
PORTB = PORTB & mask;
0000006B IN R24,0x18 In from I/O location
0000006C ANDI R24,0xF0 Logical AND with immediate
0000006D OUT 0x18,R24 Out to I/O location
PORTB = PORTB | fourbits;
0000006E SBI 0x18,3 Set bit in I/O register
0000006F RJMP PC-0x0006 Relative jump
But i like it. c is more inline with one's thinking I think.Talking about c instructions is meaningless.
#asm
MOVLW 0xAA
BANKSEL (PORTA)
MOVWF BANKMASK(PORTA)
BANKSEL (PORTB)
BSF RB1_bit
#endasm
While I am at it the language is properly call c rather then C.
What?
While I am at it the language is properly call c rather then C.
What? Are you drunk in oklahoma usa rather then Oklahoma USA?
The language c does not fall under either of these two rules so it is just c.