• AVR Freaks

Hot!Problem with MCC SPI code

Author
Franzis95
New Member
  • Total Posts : 20
  • Reward points : 0
  • Joined: 2016/07/20 07:25:24
  • Location: 0
  • Status: offline
2020/04/26 07:02:37 (permalink)
0

Problem with MCC SPI code

Hello,
I was using an older version of MCC, XC8 v1.37 and MPLABX v4.05.
Yesterday i started moving my project to the new versions of theses development tools (MPLABX v5.35, XC8 v2.10 and MCC v3.95.0). I am using MCC for the SPI interface. All the settings are the same. I only changed in my code the SPI read routine since this has another name in the new version of MCC. (Please see the attached pictures)
 
In my old project version everything was running ok. For SPI reading i was always using the function SP1_Exchange8bit(uint8_t data);, now i am using SP1_Exchangebyte(uint8_t data);. The code inside these both functions is also totally different.. (Please see the attached pictures
 
The problem is that the program hangs now in the line while(!PIR1bits.SSP1IF); of the SP1_Exchangebyte(uint8_t data); function.
 
 
I am using a PIC18F25K22 microcontroller.
 
  1. Does anyone know why is this happening?
  2. What i am doing wrong?
  3. I also notified that MSK0 is not the same as in the old version and now the field is in red. Why? Where can i change the value in MCC?
Thank you :D

Attached Image(s)

#1
ric
Super Member
  • Total Posts : 28368
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: Problem with MCC SPI code 2020/04/26 16:07:42 (permalink)
5 (1)
I see your screen captures show the SPI interrupt as disabled, but did you ever turn them on (then off again) while experimenting?
I've heard a number of reports of MCC not correctly disabling things that have been turned on then off.
The "new" code should work, so long as there is NOT an interrupt service active clearing the SSPIF bit again.
 
 
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
meanilkp
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2018/08/19 22:12:10
  • Location: India
  • Status: offline
Re: Problem with MCC SPI code 2020/06/10 22:00:49 (permalink)
0
Please share your project
#3
Jump to:
© 2020 APG vNext Commercial Version 4.5