• AVR Freaks

Hot!Problem using MPLAB ADC block in simulink

Author
Poley
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2020/06/16 08:39:05
  • Location: 0
  • Status: offline
2020/07/16 08:19:22 (permalink)
0

Problem using MPLAB ADC block in simulink

Hello,
 
I am trying to receive 12bit ADC data and view results.
 
I am currently receiving these errors when trying to build my model: 
 

 
Not sure what I am doing wrong with the block, using p33EV256GM106. Any help is appreciated, thanks!

Attached Image(s)

#1
Poley
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2020/06/16 08:39:05
  • Location: 0
  • Status: offline
Re: Problem using MPLAB ADC block in simulink 2020/07/17 01:16:25 (permalink)
0
I resolved this issue by using just 1 input at a time.
 
The problem I am now facing is that every AIN pin gives 4095 value back when in 12 bit mode (all 1's).
 
Is there anything I need to do extra to this block to set up my analogue inputs properly? Thanks!
#2
Poley
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2020/06/16 08:39:05
  • Location: 0
  • Status: offline
Re: Problem using MPLAB ADC block in simulink 2020/09/29 05:27:52 (permalink)
0
Does any one have any experience on using these ADC blocks? Still reports all 1's in model even though I know the ADC reading definitely isn't, thanks!
#3
Lubin
Moderator
  • Total Posts : 427
  • Reward points : 5
  • Joined: 2007/03/31 07:38:15
  • Location: Bayonne, France
  • Status: offline
Re: Problem using MPLAB ADC block in simulink 2020/09/29 09:48:14 (permalink)
0
Hi Poley,
 
The error message you get is clarly not Ok.
Could you please make sure you are using the latest blockset release, then upload on the forum a simple model reproducing the error.
Please join also the model which compile but provide wrong results.
 
Lubin
#4
Poley
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2020/06/16 08:39:05
  • Location: 0
  • Status: offline
Re: Problem using MPLAB ADC block in simulink 2020/09/29 11:14:06 (permalink)
0
Hi Lubin,
 
I have made a simple model showing the error.
 
Also, making the smaller model now displays code in Simulink whereas my larger model says:
 
Reference to non-existent field 'path'.
 
Not sure why it says that. 
 
Thanks
 
post edited by Poley - 2020/09/29 11:24:58
#5
Poley
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2020/06/16 08:39:05
  • Location: 0
  • Status: offline
Re: Problem using MPLAB ADC block in simulink 2020/09/29 11:55:56 (permalink)
0
Update on the code gen problem: It seems that the source files in my additional build info in causing it to not show the code in Simulink, I have shown where, not sure why it stops it.
 
 

Attached Image(s)

#6
Lubin
Moderator
  • Total Posts : 427
  • Reward points : 5
  • Joined: 2007/03/31 07:38:15
  • Location: Bayonne, France
  • Status: offline
Re: Problem using MPLAB ADC block in simulink 2020/09/29 15:15:22 (permalink)
0
Hi Poley,
 
Channels above 31 cannot be used with the hardware « SCAN » input channels conversion. Next blockset release will warm when setting with theses channel > 31 is not achievable.

You could use one channel above 31 with other AN input in parallel conversion setting in 10-bit configuration.
 
 
Another peripheral related to ADC is the Comparator-Op-Amps-Volt Ref peripheral. Maybe you might find few interesting settings with this block.
 
You mentioned an issue when using a single channel in 12 bits mode. Is that channel output ok when configured for 10 bits conversion ?
#7
Poley
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2020/06/16 08:39:05
  • Location: 0
  • Status: offline
Re: Problem using MPLAB ADC block in simulink 2020/09/30 09:27:49 (permalink)
0
Ok, I will have to use some custom code for my high channels, thanks.
 
Also do you have any idea why Simulink doesn't show my generated code that I outlined above?
 
Thanks again
#8
Jump to:
© 2020 APG vNext Commercial Version 4.5