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
How did Bill Gates benefit from free enterprise? Need a paragraph please. Will give the branliest!!
olchik [2.2K]

Answer:

Bill Gates used his skills and brains to build a business. In conclusion, Bill Gates was very successful with his industry thanks to free enterprise. He, along with his employees and friends, created and almost perfected the software known as Microsoft. The free enterprise system provides the right to private enterprise, which allowed him to choose his own business and to run it without governmental influence. Because he could create his own business and design his own products, Gates was able to specialize in technology.

Explanation:

8 0
2 years ago
In C, a switch construct can have ________ number of default case(s). *
azamat

I think so that it will be zero or more

7 0
2 years ago
The ability to anticipate and determine upcoming driving hazards and conditions are adversely affected by stress.
dybincka [34]
It can be stress or drinking, drugs, or anything of the sort.
6 0
3 years ago
If you're under 18 and you receive _____ or more license points in 12 months, you'll be restricted to driving only to school or
IRISSAK [1]

Answer:

B:6

Explanation:

FLVS :)

6 0
3 years ago
안녕 또 나야 난 너에게 미래의 메시지를 전하러 왔어 01100011 01101111 01101101 01101111 00100000 01111001 00100000 01101100 01101111 00100000 01101101
sashaice [31]

Answer:

i think its 01100001

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • When you make taffy (a pliable candy), you must heat the candy mixture to 270 degrees Fahrenheit. Write a program that will help
    6·1 answer
  • Consider the relation Courses(C, T, H, R, S, G), whose attributes can be thought of informally as course (C), teacher (T), hour
    10·1 answer
  • At the moment i am tackling the cs50x projects and i need a little bit of help with problem set 1, the 'greedy algorithm'. I am
    5·1 answer
  • Free points! your welcome
    9·2 answers
  • If a code word is defined to be a sequence of different letters chosen from the 10 letters A, B, C, D, E, F, G, H, I, and J, wha
    15·1 answer
  • You are a developer for a company that is planning on using the AWS RDS service. Your Database administrator spins up a new MySQ
    7·1 answer
  • On the Format tab, in the Shape Styles group, there is the option to change the _____. a. Shape Effects b. Shape Fill c. Shape O
    5·1 answer
  • Which of the following is a valid c++ identifier a. mouse b. _int c. 2_stop d. float​
    10·1 answer
  • True or False: To create a function in python, you start with the keyword "def"
    5·2 answers
  • Write python code that does the following: Ask the user to enter as many as number they want; Then find the sum and the average
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!