Questions tagged [pic18]

The PIC18 series 8 bit microcontrollers manufactured by Microchip Technology.

230 questions
1
vote
1 answer

C18 Passing a char array to function

I am new to C programming and microcontrollers. I am using a PIC18F24K20 microcontroller with C18. I have it set up to receive information from a computer input using USART transmit and receive functions. My goal is to compare the received word…
user3115691
  • 95
  • 4
  • 9
1
vote
0 answers

Using a USB driver for PIC18F27J53

I am attempting to use a PIC18F27J53 to decode the output from a Nintendo Entertainment System controller and use it as a USB compatible HID Joystick. I have successfully been able to read the output 60 times per second and store the status of each…
Motu88
  • 11
  • 2
1
vote
5 answers

Delay in MCC18, 48Mhz, 18F87J50

How should I write a delay macro for an PIC 18f87J50 with a 48MHz crystal and compiler of MCC18. The delay should be in us. So I for example can write: Delay_us(201) and really get 201us delay. What I have now is: #define Delay_us(n)…
Christian
  • 1,548
  • 2
  • 15
  • 26
1
vote
1 answer

Why is RB interrupt routine running twice?

I have some code below that has a slight bug that I don't know how to fix. Essentially what is happening is my high ISR is running twice after the the flag is set. It only runs twice and is consistent. The subroutine should run only once because the…
Scott James Walter
  • 427
  • 1
  • 6
  • 20
1
vote
1 answer

24 bit const pointers on XC8 PIC18 not workings

I came across this problem twice in my project and the last time I used a kind of dirty solution. Platform: PIC18F87J60, XC8 v1.12 I'm trying to use function pointers to point to functions that possibly reside in the upper halve of my ROM (>=…
Jupiter
  • 1,421
  • 2
  • 12
  • 31
1
vote
1 answer

Blinking an LED with a PIC18F4550 using Assembly code

I have recently started using a PIC18F4550, and my first attempt at programming it in assembly was to make it blink one LED on a loop. However, I do not have very much experience at programming in this language, and so had to rely on other snippets…
CJO
  • 11
  • 1
  • 2
1
vote
1 answer

pic18f14k50 not outputting

I'm using the pic 18f14k50 and I'm trying a simple test with it. Just make a LED blink. The thing is, I've already set ANSEL, ANSELH, ADCON1, etc, all to 0, also put all the PORTS as outputs. Still I haven't seen and LED blinking. Here goes the…
1
vote
2 answers

How do you make a timer for PIC18?

For the life of me I can't make a timer for PIC18 or precisely PIC18f87j11. All I want to do is to have a counter that increments every 1 second. I just want to monitor how long PIC18 been running in terms of seconds. Most of the tutorials out…
Ammar
  • 1,203
  • 5
  • 27
  • 64
1
vote
0 answers

Interrupts using PIC18f46k20 microcontroller

I am new fairly new to C++ and i'm having problems Initializing the required resisters needed for my project on motor speed control. I have used the data sheet(link below) but cannot get around the problem PIC_datasheet The two problems I am…
1
vote
1 answer

Implement timer in PIC18F for random number generation

There has been a lot of time since I don't post anything here. Today I came here looking for help to implement a timer in a PIC18F microcontroller. I want this timer to be used for using it as seed for the srand() function...but after searching a…
user1117711
1
vote
1 answer

Interrupt on PIC18 fires only once

I'm trying to get the Timer1 on my PIC18F2550 to fire interrupts every second for countdowns. So far I've been able to establish interrupt priority correctly, as well as other settings, however my ISR only fires once. I've set up my program to print…
BB ON
  • 251
  • 1
  • 3
  • 15
1
vote
2 answers

How to have more than one source file with C18 in MPLAB?

In many languages, such as C++, having lots of different source files is normal, but it doesn't seem like this is the case very often with PIC microcontroller programs -- at least not with any of the tutorials or books I've read. I'm wondering how I…
Nate
  • 26,164
  • 34
  • 130
  • 214
1
vote
2 answers

fast 8x8bit multiplication assembly pic18

Im trying to multiply two 8 bit numbers and store them in a 16 bit location for results larger than 255. The fastest way to accomplish this is through shifting, which I have tried to implement via the rrcf function and using bcf to clear unwanted…
matt
  • 79
  • 2
  • 13
1
vote
1 answer

Shift bits left in .asm for PIC18

I'm trying to shift bits left in .asm via the rlcf by rotating, and then clearing the carry. Is this going to work? If not, can I get some help? For some reason this won't compile and it's driving me crazy, this is such a simple program yet I can't…
matt
  • 79
  • 2
  • 13
0
votes
1 answer

Microchip C18 - Weird code behavior (maybe extended-mode / non-extended-mode related)

I have this weird problem with the Microchip C18 compiler for PIC18F67J60. I have created a very simple function that should return the index of a Sub-String in a larger String. I don't know whats wrong, but the behavior seems to be related to…
JakobJ
  • 1,253
  • 3
  • 16
  • 29