Embedded Code generator

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I have develop a QPSK transmitter in simulink. After thoroughly testing in simulink, its output I generated a C code for it using embedded coder(AVR 32 bit).

 

The C code I compiled in atmel studio 7.0 and it build without errors.

 

My question is that how can I simulate the code files after building them?(Rather I want to compare simulink output with c code output).

 

I tried break points at the required variable output but can not(confused) observed any output.

 

Code is generated for the given block as in .png extension.

 

Kindly give a look to the files attached.

 

Best Regards

Rizwan

 

 

Attachment(s): 

Best Regards
Rizwan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rizwan87 wrote:
My question is that how can I simulate the code files after building them?

Use the simulator in AS7  Easy.

 

Rizwan87 wrote:
I tried break points at the required variable output but can not(confused) observed any output.

Did you create a watch window with the variables you want to observe?  Keep in mind the watch window will not display local variables.

 

I will not open an .rar file.  ZIP files though I will.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim Thanks for your prompt reply.

 

I have attached .zip files too.

 

Its a build project in AS7.

 

i just want QPSK RRC Shaped variable to be observed as an output in AS&.

 

If you want simulink model than let me know I will add that too

 

Rizwan

Attachment(s): 

Best Regards
Rizwan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rizwan87 wrote:
i just want QPSK RRC Shaped variable to be observed as an output in AS&.

 

Studio spits back the following in teh watch window:

QPSKRRCShaped..........Unknown identifier

 In your code you have this:

  rtY.QPSKRRCShaped = rtDW.PipelineRegister3_DSTATE[0];

 

So in your watch window I changed what you have to:

  rtY.QPSKRRCShaped

and I now have this in the Value cell:

{cint16_T@0x05e4}

Which should  let you see what you are looking for

 

JIm

 

EDIT:

I'm a little confused.(not the first time I have typed that)

What exactly is "rtY.QPSKRRCShaped" anyway?  The code says its an output, but I don't see it called out anywhere other than the one line in HDLTx.c..

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Thu. Oct 17, 2019 - 11:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Jim,

This Variable is an output in Simulink model which must show complex IQ data .Screen shot for the output and spectrum is also shown as an attachment.

Arrow shows the output RRC QPSK shaped.

 

 

 

Best Regards

Rizwan

Attachment(s): 

Best Regards
Rizwan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thats an analog signal you are spitting out of the XMEGA pin?  I still do not see it anywhere in the code other than that spot I pointed to.

 

Dd you try the suggestions I made in post #4 to see if you get what you are looking for?

 

Hopefully another Freak smarter than I can jump in here.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Jim ,

thanks for the reply.Actually it is a digital signal which have I/Q data.

 

As I placed RRCQPSKshaped variable it showed real and imaginary part but all zero in watch window(as you specified).

 

RRCQPSKshaped should change its state after every 5uSec (rt_Onestep).

 

when I place breakpoint it never get hits on the specified variable.

 

Kindly guide me whats the issue in its execution.

 

Regards 

Rizwan

 

Best Regards
Rizwan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

how should I assign rt_onestep to clocking frequency

Best Regards
Rizwan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

have a loop with a delay:

 

while(1)

 {

  _delay_us(3); //we'll assume the rest of the code takes 2us

 do_rt_onestep()

 }

 

or use a timer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it possible for you so look into the zip attached?.

In code it says

" /* Attach rt_OneStep to a timer or interrupt service routine with
   * period 5.0E-6 seconds (the model's base sample time) here.  The
   * call syntax for rt_OneStep is
   *
   *  rt_OneStep();
   */"

 

How can I do this in main file.

Actually I want to observe a variable output QPSKRRCSHaped,it should change values.

 

I set breakpoint but it never get hits.

 

Kindly see if you can point out the issue.

Best Regards
Rizwan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I love people who say 5E-06 when they mean 5 microseconds.

 

Anyway you could setup up a timer in CTC mode and calculate a COMP value so it enters the interrupt every 6us but what micro is this. The fastest AVR8s aare 16MHz, 20MHz or in the case of Xmega 32MHz. Let's take 20MHz. At that speed a CPU cycle is 0.05us so there are 100 cycles in 5us. That will give you time to get into a time interrupt, preserve the registers, call the rt_Onestep() function then unwind but the CU won't have a LOt of time for actually doing anything else.

 

Having said that I notice in #1

Rizwan87 wrote:
embedded coder(AVR 32 bit).
so which AVR is this in fact - a UC3? If so which one and what is the clock speed?