5
votes
3answers
367 views

Fastest way to toggle a bit in ASM

What's the fastest way to toggle a bit1 in MPASM for the 14-bit enhanced instruction set? (I'm working with a PIC16F1829) The code has to be standalone - I mean that it can be called on any moment, ...
2
votes
1answer
82 views

MPLAB assembly issue code jumps

I am having some issues with what I think to be good code. This is for a uni assignment but this is not the code I'm submitting. This is a test file to understand how it all works. Some of this code ...
3
votes
1answer
100 views

PIC interrupt based soft UART timing trouble

I've tried to implement a software UART on a PIC18F452 using TIMER0 interrupts and I can't get the timing working. I'm using MPLAB ASM for compilation and the PICkit2 for programming. ...
2
votes
2answers
111 views

How can I control 8 LEDs with a timing delay with only one microcontroller (PIC12) written in Assembly?

I can have 5 I/O pins enabled. I'm just confused on how to control them individually.
2
votes
1answer
91 views

PIC18 - problems getting inline assembler routine to work

(EDIT: Added C18 disassembly code) I need to optimize a function written in C for a PIC18f4585. I am using C18 to compile. The function I am trying to re-write in assembly is: ...
3
votes
1answer
159 views

What PIC processor was this HEX-file meant for?

I have this .hex file: ...
2
votes
0answers
302 views

Need help with PIC16F887 PWM output

I am trying to get the PWM subsystem on a PIC16F887 working. I've gone over this several times and just cant seem to find my problem. This is part of a larger program, but for simplicity I re-wrote ...
7
votes
2answers
176 views

Need some help understanding PIC memory map

Some background. I use MPLABx with a PicKit2 to program different types of pics. At the moment its the 16F887. I try to stick to the Hi-Tech PICC Lite tool chain but I'm growing increasingly unhappy ...
0
votes
1answer
204 views

Problem Controlling Digital Potentiometer with Micro

I am trying to control a digital potentiometer with a PIC18F14K50 and am having a random problem (potentiometer not remembering correct value) when I power off then back on. The X9313 datasheet states ...
2
votes
1answer
295 views

c18 assembly inside function problem. unidentified label (bit names)

Here is the data_write function I'm looking at. I've been told that this method (from the textbook) is not good and I should be using the C method (that is currently commented out). When the Cbits ...
2
votes
1answer
204 views

DECFSZ won't work on PIC16LF1823

I have a problem while trying to do a Delay on a PIC16LF1823. My program tries to toggle some bits on PORTC for 30ms. I did a simple Delay based on the decrement of a variable; however, each time the ...
3
votes
3answers
624 views

PIC12F1822 program counter jumping around during debug and release programming

I am having the most awful trouble getting things up and running with my PIC12F1822. I'm using MPLAB 8.86, an ICD3 and have the chip, in a DIP package set up in a breadboard on my desk. As far as I ...
1
vote
2answers
214 views

Only beta simulator and beta MPASM assembler for 16F1503

My previous question makes me wonder whether it is even possible to develop with beta simulator and beta MPASM assembler support for 16F1503 (yellow dots): If I can't expect workign end product, ...
2
votes
1answer
411 views

PIC 16F1503 - change the frequency of internal oscillator

My configuration bits are as follows: ...
6
votes
6answers
1k views

What is the reason my PIC16 multitasking RTOS kernel doesn't work?

I am trying to create a semi-pre-emptive (co-operative) RTOS for PIC x16 microcontrollers. In my previous question, I've learnt that accessing hardware stack pointer is not possible in these cores. I ...
5
votes
5answers
3k views

How can I set the condition code in assembly language?

I want test the variable sign. In other words, I want know answer to the whether a variable is positive or negative. How can I write following if-then-else conditions in assembly language ? ...
1
vote
2answers
421 views

PIC assembly code simplify

I need to convert the following PIC assembly code (below) to an 8051 assembly. It is an inline assembly code. Actually, I intend to convert it to C. I am not familiar with the PIC MCU so I do not ...
1
vote
2answers
269 views

Creating an ASM file that will return the characters located in 8 consecutive registers

I have to create an ASM file for the PIC18F452 that does the following: (a) define the label MapName as the first of 8 consecutive registers containing a null-terminated string of not more than 7 ...
2
votes
1answer
300 views

How do I add support for PIC12LF1822 to gputils

I've used the PIC assembler and tool kit from gputils with success before, but I noticed that they're lacking support for my new pic12lf1822 chips. How do I go about getting it supported? After ...
1
vote
1answer
332 views

Bit position to bitmask conversion using MPASM directives

I'm writing firmware for a PIC16F877A in assembler, and I want to set some constants at the top of my source code to indicate which port is used for what, so that if needed I can easily change all the ...
2
votes
2answers
1k views

How do I do indirect addressing in PIC ASM?

On my 16F628A's I want to iterate of a predefined sequence of values. How do I do this? In C, I would do something like this: char vals = {22, 10, 34, 16}; char id = 0; port = vals[id]; id++ It's ...
4
votes
2answers
299 views

What's the most effective way to save/restore a PIC status bit

I want to save/restore the PIC's carry bit. I'm using the 16F628A. ...