1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
djyliett [7]
3 years ago
14

Write a (one) program for your microcontroller so that it:

Computers and Technology
1 answer:
AleksandrR [38]3 years ago
6 0

Answer:

see explaination

Explanation:

1.) Each time the main program execution starts at address 0000 - Reset Vector. The address 0004 is “reserved” for the “interrupt service routine” (ISR).

ORG 0x000 ; processor reset vector

goto main ; go to beginning of main program

ORG 0x004 ; interrupt vector location

movwf w_temp ; save off current W register contents

movf STATUS,w ; move status register into W register

movwf status_temp ; save off contents of STATUS register

.

.

RETFIE

main

3.) Push button switch is connected to the first bit of PORT B (RB0) which is configured as an input pin. When the switch is pressed this pin RB0 will be grounded. The LED is connected to the first bit of PORT B (RA0)

4.) Push button switch is connected to the first bit of PORT B (RB0) which is configured as an input pin. When the switch is pressed this pin RB0 will be grounded. The LED is connected to the first bit of PORT B (RA0)

5.) Push button switch is connected to the first bit of PORT B (RB0) which is configured as an input pin. When the switch is pressed this pin RB0 will be grounded. The LED is connected to the first bit of PORT B (RA0)

#include <stdio.h>

#include <stdlib.h>

#define _XTAL_FREQ 800000//Declare internal OSC Freq as 8MHz

#include <xc.h>

#include<pic.h>

CONFIG(FOSC_INTOSCIO & WDTE_OFF & PWRTE_OFF & MCLRE_ON & BOREN_OFF & LVP_OFF & CPD_OFF & WRT_OFF & CCPMX_RB0 & CP_OFF);

CONFIG(FCMEN_ON & IESO_ON);

unsigned int count=0;

main()

{

TRISA=0;//Sets all ports on A to be outputs

TRISB=1;//Sets all ports on B to be inputs

for(;;){

if(PORTBbits.RB0==1){//When the button is pressed the LED is off

PORTAbits.RA1 =0;

count=count+1;

}

else {

PORTAbits.RA1=1;

count = count +1;

}

if (count > 6){//if count =6 i.e 6 times button presses the RED LED turns on

PORTAbits.RA0=1;

}

else{

PORTAbits.RA0=0;

}

}

}

#include <stdio.h>

#include <stdlib.h>

#define _XTAL_FREQ 800000//Declare internal OSC Freq as 8MHz

#include <xc.h>

#include<pic.h>

CONFIG(FOSC_INTOSCIO & WDTE_OFF & PWRTE_OFF & MCLRE_ON & BOREN_OFF & LVP_OFF & CPD_OFF & WRT_OFF & CCPMX_RB0 & CP_OFF);

CONFIG(FCMEN_ON & IESO_ON);

unsigned int count=0;

main()

{

TRISA=0;//Sets all ports on A to be outputs

TRISB=1;//Sets all ports on B to be inputs

for(;;){

if(PORTBbits.RB0==1){//When the button is pressed the LED is off

PORTAbits.RA1 =0;

count=count+1;

}

else {

PORTAbits.RA1=1;

count = count +1;

}

if (count > 8){//if count =8 i.e 8 times button presses the RED LED turns on

PORTAbits.RA0=1;

}

else{

PORTAbits.RA0=0;

}

}

}

#include <stdio.h>

#include <stdlib.h>

#define _XTAL_FREQ 800000//Declare internal OSC Freq as 8MHz

#include <xc.h>

#include<pic.h>

CONFIG(FOSC_INTOSCIO & WDTE_OFF & PWRTE_OFF & MCLRE_ON & BOREN_OFF & LVP_OFF & CPD_OFF & WRT_OFF & CCPMX_RB0 & CP_OFF);

CONFIG(FCMEN_ON & IESO_ON);

unsigned int count=0;

main()

{

TRISA=0;//Sets all ports on A to be outputs

TRISB=1;//Sets all ports on B to be inputs

for(;;){

if(PORTBbits.RB0==1){//When the button is pressed the LED is off

PORTAbits.RA1 =0;

count=count+1;

}

else {

PORTAbits.RA1=1;

count = count +1;

}

if (count > 10){//if count =10 i.e 10 times button presses the RED LED turns on

PORTAbits.RA0=1;

}

else{

PORTAbits.RA0=0;

}

}

}

You might be interested in
Your website is currently at position 5 in organic search. On a monthly basis you currently get on average 5,432 clicks and 32 c
Natalka [10]

Answer:

Answered

Explanation:

This one is worth if I can get more number of clicks and the conversions.

SEO plays a vital role in bringing the website ahead of the competition. In the long run, if a website can reach their target audience with the organic search, then it saves a lot spending over the paid campaigns to bring business. Bringing the website to first position will automatically increase the impression which in turn will result in the more clicks and conversions.

7 0
3 years ago
What is some effective writing techniques?
scoray [572]
Be persuasive, have form, and know what you are talking about. I would recommend using MELCON.  You can learn more about MELCON with this link.  http://melcon.weebly.com/
3 0
2 years ago
What is 16/17 simplified?
77julia77 [94]
16/17 can't be simplified but if you want it as a decimal it's 0.9412 or 0.94
7 0
3 years ago
Read 2 more answers
Http://moomoo.io/?server=8:16:0
love history [14]

Explanation:

noooooooooooooooooooooooooooooooooo

5 0
3 years ago
Read 2 more answers
What form of note taking would be MOST beneficial for a visual learner who needs to see the connections between ideas?
Svetlanka [38]

Answer:

Think link

Explanation:

8 0
3 years ago
Other questions:
  • Which computer device works like the human central nervous system by connecting all the computer’s parts together and allowing t
    9·1 answer
  • A smart phone is always a _____.<br> client<br> server<br> network<br> process
    10·1 answer
  • Displays are geared for a specific resolution. what is this resolution called?
    15·1 answer
  • All of the following are aspects of the search process except?
    5·2 answers
  • (a) Convert to hexadecimal: 1457.1110. Round to two digits past the hexadecimal point.
    8·1 answer
  • Setting the isShowing property to false of the opacity property to o will delete an object from an Alice world.
    15·2 answers
  • What are the characteristics of good blogs?
    8·1 answer
  • Como a contribuido el desarrollo tecnologico a mejorar la calidad debida de los seres humanos
    11·1 answer
  • What is the action of extracting data fragments and then reassembling them in order to recover a file?.
    10·1 answer
  • Fifteen years ago, everyone didn't have a cell phone. Anyone developing an app would not have found many users. Today, the exist
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!